[pulseaudio-discuss] [PATCH v0 04/16] bluetooth: Fix potential assertion failure

Mikel Astiz mikel.astiz.oss at gmail.com
Fri Sep 28 08:45:28 PDT 2012


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

It might happen that a PropertyChanged signal is received but the
corresponding card profile has not been created, leading to an assertion
failure in filter_cb() due to inexistent ports. This can happen if BlueZ
misbehaves, or also if the UUIDs are reported later on (i.e. during
pairing discovery). In any case, the signal should just be ignored.
---
 src/modules/bluetooth/module-bluetooth-device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 82d81b3..5a035d1 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1360,7 +1360,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
     } else if (dbus_message_is_signal(m, "org.bluez.HandsfreeGateway", "PropertyChanged")) {
         pa_bt_audio_state_t state = parse_state_property_change(m);
 
-        if (state != PA_BT_AUDIO_STATE_INVALID) {
+        if (state != PA_BT_AUDIO_STATE_INVALID && pa_hashmap_get(u->card->profiles, "hfgw")) {
             pa_device_port *port;
             pa_port_available_t available = audio_state_to_availability(state);
 
@@ -1376,7 +1376,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
     } else if (dbus_message_is_signal(m, "org.bluez.Headset", "PropertyChanged")) {
         pa_bt_audio_state_t state = parse_state_property_change(m);
 
-        if (state != PA_BT_AUDIO_STATE_INVALID) {
+        if (state != PA_BT_AUDIO_STATE_INVALID && pa_hashmap_get(u->card->profiles, "hsp")) {
             pa_device_port *port;
             pa_port_available_t available = audio_state_to_availability(state);
 
@@ -1392,7 +1392,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
     } else if (dbus_message_is_signal(m, "org.bluez.AudioSource", "PropertyChanged")) {
         pa_bt_audio_state_t state = parse_state_property_change(m);
 
-        if (state != PA_BT_AUDIO_STATE_INVALID) {
+        if (state != PA_BT_AUDIO_STATE_INVALID && pa_hashmap_get(u->card->profiles, "a2dp_source")) {
             pa_device_port *port;
             pa_port_available_t available = audio_state_to_availability(state);
 
@@ -1405,7 +1405,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
     } else if (dbus_message_is_signal(m, "org.bluez.AudioSink", "PropertyChanged")) {
         pa_bt_audio_state_t state = parse_state_property_change(m);
 
-        if (state != PA_BT_AUDIO_STATE_INVALID) {
+        if (state != PA_BT_AUDIO_STATE_INVALID && pa_hashmap_get(u->card->profiles, "a2dp")) {
             pa_device_port *port;
             pa_port_available_t available = audio_state_to_availability(state);
 
-- 
1.7.11.4



More information about the pulseaudio-discuss mailing list