[PATCH v2 BlueZ 4/5] audio/transport: Fix not emitting Volume changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

If Volume is changed locally the change should be propagated using
PropertiesChanged.
---
 profiles/audio/transport.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index f5c829f..7e3d1e6 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -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[] = {
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux