From ef9673dcb4ae4311531cd5dd02c85530036d8ff0 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 23 Jul 2013 15:52:32 +0300 Subject: [PATCH] audio/player: Fix attempting to set the same setting value This cause unnecessary commands to be sent over the air so instead the code should just return success as nothing should be changed. --- profiles/audio/player.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/profiles/audio/player.c b/profiles/audio/player.c index 917c66e1a..a817b5479 100644 --- a/profiles/audio/player.c +++ b/profiles/audio/player.c @@ -263,7 +263,7 @@ static void set_setting(const GDBusPropertyTable *property, void *data) { struct media_player *mp = data; - const char *value; + const char *value, *current; if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING) { g_dbus_pending_property_error(id, @@ -274,6 +274,12 @@ static void set_setting(const GDBusPropertyTable *property, dbus_message_iter_get_basic(iter, &value); + current = g_hash_table_lookup(mp->settings, property->name); + if (g_strcmp0(current, value) == 0) { + g_dbus_pending_property_success(id); + return; + } + player_set_setting(mp, id, property->name, value); } -- 2.11.0