summaryrefslogtreecommitdiffstats
path: root/audio/unix.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-08-20 08:50:22 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-08-20 08:50:22 +0000
commit730a4ceb9e7e986e2a327fa7e023c3dd2102a50d (patch)
treea19fc7a8d901abd7b8429673fec69d1d37dd7d56 /audio/unix.c
parent78a94059160d7478624cad315022255f7ebbbe80 (diff)
Improve handling of simultaneous connect attempts to different devices
Diffstat (limited to 'audio/unix.c')
-rw-r--r--audio/unix.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/audio/unix.c b/audio/unix.c
index f8832c91..9bf1a9ca 100644
--- a/audio/unix.c
+++ b/audio/unix.c
@@ -198,6 +198,11 @@ static void a2dp_setup_complete(struct avdtp *session, struct device *dev,
if (!stream)
goto failed;
+ if (!a2dp_source_lock(dev, session)) {
+ error("Unable to lock A2DP source SEP");
+ goto failed;
+ }
+
a2dp->stream = stream;
if (!avdtp_stream_get_transport(stream, &fd, &cfg->pkt_len, &caps)) {
@@ -273,8 +278,9 @@ static void a2dp_setup_complete(struct avdtp *session, struct device *dev,
failed:
error("stream setup failed");
+ if (a2dp->stream)
+ a2dp_source_unlock(dev, session);
unix_send_cfg(client->sock, NULL, -1);
- a2dp_source_unlock(dev, session);
avdtp_unref(a2dp->session);
a2dp->session = NULL;
a2dp->stream = NULL;
@@ -307,17 +313,11 @@ proceed:
if (!a2dp->session)
a2dp->session = avdtp_get(&dev->src, &dev->dst);
- if (!a2dp_source_lock(dev, a2dp->session)) {
- error("Unable to lock A2DP source SEP");
- goto failed;
- }
-
id = a2dp_source_request_stream(a2dp->session, dev,
TRUE, a2dp_setup_complete,
client);
if (id == 0) {
error("request_stream failed");
- a2dp_source_unlock(dev, a2dp->session);
goto failed;
}