diff options
-rw-r--r-- | audio/avdtp.c | 12 | ||||
-rw-r--r-- | audio/manager.c | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c index 649e69a4..0b56340f 100644 --- a/audio/avdtp.c +++ b/audio/avdtp.c @@ -2088,7 +2088,17 @@ struct avdtp *avdtp_get(bdaddr_t *src, bdaddr_t *dst) gboolean avdtp_is_connected(bdaddr_t *src, bdaddr_t *dst) { - return find_session(src, dst) == NULL ? FALSE : TRUE; + struct avdtp *session; + + session = find_session(src, dst); + + if (!session) + return FALSE; + + if (session->state != AVDTP_SESSION_STATE_DISCONNECTED) + return TRUE; + + return FALSE; } gboolean avdtp_stream_get_transport(struct avdtp_stream *stream, int *sock, diff --git a/audio/manager.c b/audio/manager.c index 4d8d424d..c1a72b8f 100644 --- a/audio/manager.c +++ b/audio/manager.c @@ -1681,7 +1681,8 @@ struct device *manager_get_connected_device(void) for (l = devices; l != NULL; l = g_slist_next(l)) { struct device *device = l->data; - if (device->sink && sink_is_active(device)) + if ((device->sink || device->source) && + avdtp_is_connected(&device->src, &device->dst)) return device; if (device->headset && headset_is_active(device)) |