[RFC next v4 11/16] bluetooth: Support transport auto-release

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2013-04-29 at 18:28 +0200, Mikel Astiz wrote:
> From: Mikel Astiz <mikel.astiz at bmw-carit.de>
> 
> 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 | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
> index 8554d5d..e3de01e 100644
> --- a/src/modules/bluetooth/bluetooth-util.c
> +++ b/src/modules/bluetooth/bluetooth-util.c
> @@ -1532,6 +1532,9 @@ void pa_bluetooth_transport_release(pa_bluetooth_transport *t) {
>  
>          pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path, "org.bluez.MediaTransport", "Release"));
>          pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_STRING, &accesstype, DBUS_TYPE_INVALID));
> +    } else if (t->state <= PA_BLUETOOTH_TRANSPORT_STATE_IDLE) {
> +        pa_log_info("Transport %s auto-released by BlueZ or already released", t->path);
> +        return;
>      } else {
>          pa_assert(t->device->discovery->version == BLUEZ_VERSION_5);
>          pa_assert_se(m = dbus_message_new_method_call(t->owner, t->path, "org.bluez.MediaTransport1", "Release"));

Nitpicking: I'd prefer to have the state check inside the else block, so
that at the top level there would be only one branch for bluez 4 and
bluez 5.

-- 
Tanu

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux