[pulseaudio-discuss] [PATCH 13/17] bluetooth: Suspend the source/sink the HFP-oFono stream fd HUP

Luiz Augusto von Dentz luiz.dentz at gmail.com
Fri Aug 22 07:04:58 PDT 2014


From: João Paulo Rechi Vita <jprvita at openbossa.org>

---
 src/modules/bluetooth/module-bluez5-device.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c
index 5398a1b..7ea4b55 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -1976,6 +1976,7 @@ static pa_hook_result_t transport_state_changed_cb(pa_bluetooth_discovery *y, pa
 /* Run from main thread context */
 static int device_process_msg(pa_msgobject *obj, int code, void *data, int64_t offset, pa_memchunk *chunk) {
     struct bluetooth_msg *m = BLUETOOTH_MSG(obj);
+    struct userdata *u = m->card->userdata;
 
     switch (code) {
         case BLUETOOTH_MESSAGE_IO_THREAD_FAILED:
@@ -1986,6 +1987,11 @@ static int device_process_msg(pa_msgobject *obj, int code, void *data, int64_t o
             pa_assert_se(pa_card_set_profile(m->card, pa_hashmap_get(m->card->profiles, "off"), false) >= 0);
             break;
         case BLUETOOTH_MESSAGE_STREAM_FD_HUP:
+            if (u->transport->profile == PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY) {
+                pa_source_suspend(u->source, true, PA_SUSPEND_USER);
+                pa_sink_suspend(u->sink, true, PA_SUSPEND_USER);
+                pa_bluetooth_transport_put(u->transport);
+            }
             break;
     }
 
-- 
1.9.3



More information about the pulseaudio-discuss mailing list