bluetooth: Release MediaEnpoint if card profile is set to Off
authorFrédéric Dalleau <frederic.dalleau@linux.intel.com>
Tue, 4 Oct 2011 07:37:23 +0000 (09:37 +0200)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Wed, 2 Nov 2011 18:51:39 +0000 (00:21 +0530)
If card profile is set to "off", the audio stream should be released.
Current implementation releases the stream when the card profile
is changed to "hsp" or "hfgw" again and immediatly reconnects after that.

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

index 81abcd6..4d1969b 100644 (file)
@@ -2564,6 +2564,13 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
     }
 
     stop_thread(u);
+
+    if (u->profile != PROFILE_OFF && u->transport) {
+        bt_transport_release(u);
+        pa_xfree(u->transport);
+        u->transport = NULL;
+    }
+
     shutdown_bt(u);
 
     if (USE_SCO_OVER_PCM(u))