audio/transport: Fix not emitting volume changes 29/51429/1
authorBharat Panda <bharat.panda@samsung.com>
Mon, 9 Nov 2015 12:44:37 +0000 (18:14 +0530)
committerBharat Panda <bharat.panda@samsung.com>
Mon, 9 Nov 2015 12:46:27 +0000 (18:16 +0530)
Changes taken to add fix for not emitting volume change notification.

If Volume is changed locally the change should be propagated
using PropertiesChanged.

git repo link:
http://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=4f7843a0fcc1a0a4336004de2702f657fb97b5ff

Change-Id: I97075d0daf716144f505ae39415727b77f54e5b9

profiles/audio/transport.c

index f5c829f..b4cf57d 100644 (file)
@@ -653,6 +653,7 @@ static void set_volume(const GDBusPropertyTable *property,
        struct media_transport *transport = data;
        struct a2dp_transport *a2dp = transport->data;
        uint16_t volume;
+       bool notify;
 
        if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_UINT16) {
                g_dbus_pending_property_error(id,
@@ -670,13 +671,21 @@ static void set_volume(const GDBusPropertyTable *property,
                return;
        }
 
-       if (a2dp->volume != volume)
-               avrcp_set_volume(transport->device, volume,
-                               transport->source_watch ? true : false);
+       g_dbus_pending_property_success(id);
+
+       if (a2dp->volume == volume)
+               return;
 
        a2dp->volume = volume;
 
-       g_dbus_pending_property_success(id);
+       notify = transport->source_watch ? true : false;
+       if (notify)
+               g_dbus_emit_property_changed(btd_get_dbus_connection(),
+                                       transport->path,
+                                       MEDIA_TRANSPORT_INTERFACE,
+                                       "Volume");
+
+       avrcp_set_volume(transport->device, volume, notify);
 }
 
 static const GDBusMethodTable transport_methods[] = {