diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-02-20 15:44:28 +0200 |
---|---|---|
committer | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2012-02-21 08:36:21 +0530 |
commit | 014511310a074a95d10d76f0ea9107ee0b80bed2 (patch) | |
tree | 4d84c151e74a3e0fee503871d271bc32b4a6e785 /src/modules/bluetooth/bluetooth-util.c | |
parent | d9cd26f676ed8476a4e1e4293927177d8495b97b (diff) | |
download | pulseaudio-014511310a074a95d10d76f0ea9107ee0b80bed2.tar.gz |
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.
Diffstat (limited to 'src/modules/bluetooth/bluetooth-util.c')
-rw-r--r-- | src/modules/bluetooth/bluetooth-util.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index 15c544eee..3f39a91c2 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; |