summaryrefslogtreecommitdiff
path: root/src/modules/bluetooth/bluetooth-util.c
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2013-05-10 10:30:47 +0200
committerArun Raghavan <arun.raghavan@collabora.co.uk>2013-06-04 00:38:42 +0530
commit0e4c16e120f95b122c7139deb046192927d1b6c7 (patch)
tree7a522367cf27585d9a8d14ae103334c5f6574219 /src/modules/bluetooth/bluetooth-util.c
parent9615def4b96f0bab365ddc03f6c003f382a54752 (diff)
downloadpulseaudio-0e4c16e120f95b122c7139deb046192927d1b6c7.tar.gz
bluetooth: Support transport auto-release
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.
Diffstat (limited to 'src/modules/bluetooth/bluetooth-util.c')
-rw-r--r--src/modules/bluetooth/bluetooth-util.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 2e794ac3c..59247364c 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -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"));
}