summaryrefslogtreecommitdiffstats
path: root/audio/a2dp.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-08-31 06:21:52 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-08-31 06:21:52 +0000
commit828133c3180a090a06ace6637d9f84ae5f57ae33 (patch)
tree61efa12b085249c99f22b04bc1b8b1c555b16140 /audio/a2dp.c
parent0ad9f50ac3cfb1885fec839d6ac0be5fdc5aabd1 (diff)
Fix local SEP locking when connecting fails or unix client disconnects
Diffstat (limited to 'audio/a2dp.c')
-rw-r--r--audio/a2dp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/audio/a2dp.c b/audio/a2dp.c
index 45a1bfe0..1505b798 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -75,6 +75,7 @@ struct a2dp_stream_cb {
struct a2dp_stream_setup {
struct avdtp *session;
struct device *dev;
+ struct a2dp_sep *sep;
struct avdtp_stream *stream;
struct avdtp_service_capability *media_codec;
gboolean start;
@@ -110,6 +111,8 @@ static void setup_callback(struct a2dp_stream_cb *cb,
static gboolean finalize_stream_setup(struct a2dp_stream_setup *s)
{
+ if (!s->stream)
+ s->sep->used_by = NULL;
g_slist_foreach(setup->cb, (GFunc) setup_callback, setup);
stream_setup_free(setup);
return FALSE;
@@ -289,7 +292,7 @@ static void discovery_complete(struct avdtp *session, GSList *seps, int err,
struct avdtp_remote_sep *rsep;
GSList *caps = NULL;
- if (err < 0) {
+ if (err < 0 || setup->canceled) {
setup->stream = NULL;
finalize_stream_setup(setup);
return;
@@ -961,8 +964,10 @@ gboolean a2dp_source_cancel_stream(struct device *dev, unsigned int id)
setup->cb = g_slist_remove(setup->cb, cb_data);
g_free(cb_data);
- if (!setup->cb)
+ if (!setup->cb) {
setup->canceled = TRUE;
+ setup->sep->used_by = NULL;
+ }
return TRUE;
}
@@ -1022,6 +1027,7 @@ unsigned int a2dp_source_request_stream(struct avdtp *session,
setup = g_new0(struct a2dp_stream_setup, 1);
setup->session = avdtp_ref(session);
+ setup->sep = sep;
setup->dev = dev;
setup->cb = g_slist_append(setup->cb, cb_data);
setup->start = start;