stream-manager-dbus: Update mute vconf only after internal set is successful 65/255265/1
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 16 Mar 2021 05:36:54 +0000 (14:36 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 16 Mar 2021 05:38:30 +0000 (14:38 +0900)
[Version] 13.0.50
[Issue Type] Bug fix

Change-Id: Id58f2d54e5a88c583f87ab2ecaa56823b36fd8b3
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/pulseaudio-modules-tizen.spec
src/stream-manager-dbus.c

index 06a0216..351047c 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          13.0.49
+Version:          13.0.50
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index 80ec2c1..2f6e4c6 100644 (file)
@@ -1321,6 +1321,7 @@ static void handle_set_volume_mute(DBusConnection *conn, DBusMessage *msg, void
     const char *direction = NULL;
     const char *type = NULL;
     dbus_uint32_t do_mute = 0;
+    bool old_mute = false;
     stream_type_t stream_type = STREAM_SINK_INPUT;
     ret_msg_t ret = RET_MSG_OK;
 
@@ -1340,14 +1341,21 @@ static void handle_set_volume_mute(DBusConnection *conn, DBusMessage *msg, void
         goto finish;
     }
 
-    /* check vconf update here, mute will not be set if update fails */
-    if (update_mute_vconf(type, do_mute) != 0) {
+    if (get_volume_mute_by_type(m, stream_type, type, &old_mute) != 0) {
         ret = RET_MSG_ERROR_INTERNAL;
         goto finish;
     }
 
-    if (set_volume_mute_by_type(m, stream_type, type, (bool)do_mute) != 0)
+    if (set_volume_mute_by_type(m, stream_type, type, (bool)do_mute) != 0) {
         ret = RET_MSG_ERROR_INTERNAL;
+        goto finish;
+    }
+
+    if (update_mute_vconf(type, do_mute) != 0) {
+        ret = RET_MSG_ERROR_INTERNAL;
+        pa_log_error("Failed to update mute vconf, rollback to old mute[%u]", old_mute);
+        set_volume_mute_by_type(m, stream_type, type, old_mute);
+    }
 
 finish:
     pa_dbus_send_basic_value_reply(conn, msg, DBUS_TYPE_STRING, &stream_manager_dbus_ret_str[ret]);