[pulseaudio-commits] src/modules

Arun Raghavan arun at kemper.freedesktop.org
Mon Feb 20 19:14:24 PST 2012


 src/modules/bluetooth/bluetooth-util.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 014511310a074a95d10d76f0ea9107ee0b80bed2
Author: Luiz Augusto von Dentz <luiz.von.dentz at intel.com>
Date:   Mon Feb 20 15:44:28 2012 +0200

    bluetooth: Fix calling many times Audio.GetProperties for the same device
    
    Audio.GetProperties is been called for as many times as there are UUIDs
    instead of just once when the UUIDs are discovered.

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 15c544e..3f39a91 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -268,11 +268,12 @@ static int parse_device_property(pa_bluetooth_discovery *y, pa_bluetooth_device
 
             if (dbus_message_iter_get_arg_type(&ai) == DBUS_TYPE_STRING &&
                 pa_streq(key, "UUIDs")) {
+                    DBusMessage *m;
+                    pa_bool_t has_audio = FALSE;
 
                 while (dbus_message_iter_get_arg_type(&ai) != DBUS_TYPE_INVALID) {
                     pa_bluetooth_uuid *node;
                     const char *value;
-                    DBusMessage *m;
 
                     dbus_message_iter_get_basic(&ai, &value);
                     node = uuid_new(value);
@@ -282,24 +283,30 @@ static int parse_device_property(pa_bluetooth_discovery *y, pa_bluetooth_device
                     if (strcasecmp(HSP_AG_UUID, value) == 0 || strcasecmp(HFP_AG_UUID, value) == 0) {
                         pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.HandsfreeGateway", "GetProperties"));
                         send_and_add_to_pending(y, m, get_properties_reply, d);
+                        has_audio = TRUE;
                     } else if (strcasecmp(HSP_HS_UUID, value) == 0 || strcasecmp(HFP_HS_UUID, value) == 0) {
                         pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.Headset", "GetProperties"));
                         send_and_add_to_pending(y, m, get_properties_reply, d);
+                        has_audio = TRUE;
                     } else if (strcasecmp(A2DP_SINK_UUID, value) == 0) {
                         pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.AudioSink", "GetProperties"));
                         send_and_add_to_pending(y, m, get_properties_reply, d);
+                        has_audio = TRUE;
                     } else if (strcasecmp(A2DP_SOURCE_UUID, value) == 0) {
                         pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.AudioSource", "GetProperties"));
                         send_and_add_to_pending(y, m, get_properties_reply, d);
+                        has_audio = TRUE;
                     }
 
-                    /* this might eventually be racy if .Audio is not there yet, but the State change will come anyway later, so this call is for cold-detection mostly */
-                    pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.Audio", "GetProperties"));
-                    send_and_add_to_pending(y, m, get_properties_reply, d);
-
                     if (!dbus_message_iter_next(&ai))
                         break;
                 }
+
+                /* this might eventually be racy if .Audio is not there yet, but the State change will come anyway later, so this call is for cold-detection mostly */
+                if (has_audio) {
+                    pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.Audio", "GetProperties"));
+                    send_and_add_to_pending(y, m, get_properties_reply, d);
+                }
             }
 
             break;



More information about the pulseaudio-commits mailing list