[pulseaudio-discuss] [PATCH 1/3] bluetooth: Only create backend instance once objects are listed

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Mon Sep 8 02:46:13 PDT 2014


On Mon, 2014-09-08 at 12:14 +0300, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz at intel.com>
> 
> This makes sure the devices are discovered before the backend start
> creating new transports.
> ---
>  src/modules/bluetooth/bluez5-util.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
> index 93677b4..818790d 100644
> --- a/src/modules/bluetooth/bluez5-util.c
> +++ b/src/modules/bluetooth/bluez5-util.c
> @@ -889,6 +889,9 @@ static void get_managed_objects_reply(DBusPendingCall *pending, void *userdata)
>  
>      y->objects_listed = true;
>  
> +    if (!y->backend)
> +        y->backend = pa_bluetooth_backend_new(y->core);
> +
>  finish:
>      dbus_message_unref(r);
>  
> @@ -1591,7 +1594,6 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
>  
>      endpoint_init(y, PA_BLUETOOTH_PROFILE_A2DP_SINK);
>      endpoint_init(y, PA_BLUETOOTH_PROFILE_A2DP_SOURCE);
> -    y->backend = pa_bluetooth_backend_new(c);
>  
>      get_managed_objects(y);
>  

The idea is that the backend should only exist when objects_listed is
true, right? If so, you need to free the backend when objects_listed is
set to false.

This also doesn't solve the problem that if a new device appears,
there's a race between BlueZ and oFono about which one's signals will
reach PulseAudio first. I believe we don't handle it properly if oFono
wins.

-- 
Tanu



More information about the pulseaudio-discuss mailing list