]> code.delx.au - pulseaudio/commitdiff
bluetooth: Support transport auto-release
authorMikel Astiz <mikel.astiz@bmw-carit.de>
Fri, 10 May 2013 08:30:47 +0000 (10:30 +0200)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Mon, 3 Jun 2013 19:08:42 +0000 (00:38 +0530)
With BlueZ 5, if the remote device suspends the audio, the transport
state will change to "idle" and the endpoint is not required to release
the transport, since this could introduce race conditions. Therefore,
ignore the call to pa_bluetooth_transport_release() if the transport is
not acquired any more.

src/modules/bluetooth/bluetooth-util.c

index 2e794ac3c5c4606e3c9200d59a2b1831e5be69d5..59247364ce60f070aa377e743ba54d5f11b64b2f 100644 (file)
@@ -1538,6 +1538,12 @@ void pa_bluetooth_transport_release(pa_bluetooth_transport *t) {
         pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_STRING, &accesstype, DBUS_TYPE_INVALID));
     } else {
         pa_assert(t->device->discovery->version == BLUEZ_VERSION_5);
+
+        if (t->state <= PA_BLUETOOTH_TRANSPORT_STATE_IDLE) {
+            pa_log_info("Transport %s auto-released by BlueZ or already released", t->path);
+            return;
+        }
+
         pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path, "org.bluez.MediaTransport1", "Release"));
     }