[pulseaudio-discuss] [RFC v0 01/15] bluetooth: Do not check profile states is device_audio_is_ready()

Mikel Astiz mikel.astiz.oss at gmail.com
Wed Dec 19 04:58:20 PST 2012


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

The function is used to make sure some basic information has already
been gathered before the device is being used. At this point profile
states can be ignored, since their initial value will be
PA_BT_AUDIO_STATE_INVALID and thus effectively similar to
PA_BT_AUDIO_STATE_DISCONNECTED due to audio_state_to_transport_state().

The change should make no difference given that the behavior of
pa_bluetooth_device_any_audio_connected() doesn't change: by the time
TRUE is returned, a transport needs to exist. This means a profile
will exist in CONNECTING or CONNECTED state and thus the old
implementation of device_audio_is_ready() would also have returned TRUE.
---
 src/modules/bluetooth/bluetooth-util.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 61c52f5..cb320fc 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -234,18 +234,12 @@ static void device_free(pa_bluetooth_device *d) {
 }
 
 static pa_bool_t device_is_audio_ready(const pa_bluetooth_device *d) {
-    unsigned i;
-
     pa_assert(d);
 
     if (!d->device_info_valid || d->audio_state == PA_BT_AUDIO_STATE_INVALID)
         return FALSE;
 
-    for (i = 0; i < PA_BLUETOOTH_PROFILE_COUNT; i++)
-        if (d->profile_state[i] != PA_BT_AUDIO_STATE_INVALID)
-            return TRUE;
-
-    return FALSE;
+    return TRUE;
 }
 
 static const char *check_variant_property(DBusMessageIter *i) {
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list