summaryrefslogtreecommitdiffstats
path: root/audio/avdtp.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-10-08 14:44:54 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2008-10-08 14:44:54 +0200
commit3161f96838b8f79574ee93b0525942d7c732535e (patch)
tree37c932f0185a0ee8a69a585850c6e20ef0851230 /audio/avdtp.c
parent586fd91a6c1a18e7e324fe39c20786be357c3576 (diff)
Create audio device objects on incoming connections if necessary
If we haven't done SDP yet the data structures will be uninitialized. This patch makes sure that the structures are properly initialized if we get an incoming connection before service discovery has been done.
Diffstat (limited to 'audio/avdtp.c')
-rw-r--r--audio/avdtp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c
index 26e38b5d..63b9bdc4 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -48,6 +48,7 @@
#include "control.h"
#include "avdtp.h"
#include "glib-helper.h"
+#include "sink.h"
#include <bluetooth/l2cap.h>
@@ -2748,6 +2749,7 @@ static void avdtp_server_cb(GIOChannel *chan, int err, const bdaddr_t *src,
socklen_t size;
struct l2cap_options l2o;
struct avdtp *session;
+ struct audio_device *dev;
char address[18];
if (err < 0) {
@@ -2780,6 +2782,15 @@ static void avdtp_server_cb(GIOChannel *chan, int err, const bdaddr_t *src,
goto drop;
}
+ dev = manager_get_device(src, dst, NULL);
+ if (!dev) {
+ error("Unable to get audio device object for %s", address);
+ goto drop;
+ }
+
+ if (!dev->sink)
+ dev->sink = sink_init(dev);
+
session->mtu = l2o.imtu;
session->sock = sk;