]> code.delx.au - pulseaudio/commitdiff
bluetooth: Do not setup stream before thread starts
authorMikel Astiz <mikel.astiz@bmw-carit.de>
Mon, 3 Dec 2012 10:03:58 +0000 (11:03 +0100)
committerTanu Kaskinen <tanuk@iki.fi>
Tue, 4 Dec 2012 01:08:57 +0000 (03:08 +0200)
bt_transport_acquire() might get called from the main thread, in case
the IO thread hasn't been started yet. In this case, we should not call
setup_stream() since this is going to be called in the beginning of
thread_func().

src/modules/bluetooth/module-bluetooth-device.c

index 7d89f6ca17a8700102bde6015cee50b15188b9aa..f8315e1e53b3166512608a9b665032454e328bfa 100644 (file)
@@ -426,6 +426,10 @@ static int bt_transport_acquire(struct userdata *u, pa_bool_t start) {
         return 0;
 
 done:
+    /* If thread is still about to start, the stream will be set up in the beginning of thread_func() */
+    if (u->thread == NULL)
+        return 0;
+
     setup_stream(u);
 
     return 0;