[pulseaudio-discuss] [PATCH v1 2/3] bluetooth: Do not setup stream before thread starts

Mikel Astiz mikel.astiz.oss at gmail.com
Mon Dec 3 02:03:58 PST 2012


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

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 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 3216cb2..b5ab7a1 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -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;
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list