[pulseaudio-discuss] [PATCH] bluetooth: Fix bluetooth.nrec property not updated

Frédéric Danis frederic.danis at linux.intel.com
Tue May 29 05:06:33 PDT 2012


PropertyChanged signal of org.BlueZ.MediaTransport is processed in
pa_bluetooth_transport_parse_property() which updates t->nrec.
This is called by :
- First by filter_cb() of bluetooth-util.c
- Then by filter_cb()of module-bluetooth-device.c which retrieve value
  of t->nrec before calling parse function, then it checks if t->nrec
  has changed before updating bluetooth.nrec property.
  As t->nrec has alreday been changed during first process, property
  update is never performed.
---
 src/modules/bluetooth/module-bluetooth-device.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 0b12cc7..1559a3c 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1814,7 +1814,8 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
     } else if (dbus_message_is_signal(m, "org.bluez.MediaTransport", "PropertyChanged")) {
         DBusMessageIter arg_i;
         pa_bluetooth_transport *t;
-        pa_bool_t nrec;
+        const char *str;
+        int nrec = -1;
 
         t = (pa_bluetooth_transport *) pa_bluetooth_discovery_get_transport(u->discovery, u->transport);
         pa_assert(t);
@@ -1824,11 +1825,14 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
             goto fail;
         }
 
-        nrec = t->nrec;
-
         if (pa_bluetooth_transport_parse_property(t, &arg_i) < 0)
             goto fail;
 
+        /* Update Noise reduction and echo cancellation if needed */
+        str = pa_proplist_gets(u->source->proplist, "bluetooth.nrec");
+        if (str != NULL)
+            nrec = pa_parse_boolean(str);
+
         if (nrec != t->nrec) {
             pa_log_debug("dbus: property 'NREC' changed to value '%s'", t->nrec ? "True" : "False");
             pa_proplist_sets(u->source->proplist, "bluetooth.nrec", t->nrec ? "1" : "0");
-- 
1.7.9.5



More information about the pulseaudio-discuss mailing list