stream-manager-dbus: update volume vconf only after internal set is successful 10/254510/5 accepted/tizen/unified/20210308.070954 submit/tizen/20210305.042519
authorSeungbae Shin <seungbae.shin@samsung.com>
Thu, 4 Mar 2021 04:02:13 +0000 (13:02 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 5 Mar 2021 02:43:24 +0000 (11:43 +0900)
[Version] 13.0.48
[Issue Type] Bug fix

Change-Id: I9238bbe1602b43f1ac1c56ef0029d248ddb56a22

packaging/pulseaudio-modules-tizen.spec
src/stream-manager-dbus.c

index 9270deb93fd652404dd84037b481063cbbd0c24b..005241fe34585abe29033bb60df303851a2a9e8f 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          13.0.47
+Version:          13.0.48
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index d9320f5c1386798b4cb359a8233a62e70913f638..40b2160dfc5abdedb0388bad63c8fe9a0cf22e57 100644 (file)
@@ -1199,8 +1199,9 @@ static void handle_set_volume_level(DBusConnection *conn, DBusMessage *msg, void
     const char *direction = NULL;
     const char *type = NULL;
     dbus_uint32_t level = 0;
+    uint32_t old_level = 0;
     stream_type_t stream_type = STREAM_SINK_INPUT;
-    int ret = 0;
+    int ret = RET_MSG_OK;
 
     pa_assert(conn);
     pa_assert(msg);
@@ -1218,19 +1219,26 @@ static void handle_set_volume_level(DBusConnection *conn, DBusMessage *msg, void
         goto finish;
     }
 
-    /* check vconf update here, volume will not be set if update fails */
-    if ((ret = update_volume_vconf(type, level))) {
+    if (get_volume_level_by_type(m, GET_VOLUME_CURRENT_LEVEL, stream_type, type, &old_level) != 0) {
         ret = RET_MSG_ERROR_INTERNAL;
         goto finish;
     }
 
-    if ((ret = set_volume_level_by_type(m, stream_type, type, level)) != 0)
+    if ((ret = set_volume_level_by_type(m, stream_type, type, level)) != 0) {
         ret = (ret == -2) ? RET_MSG_ERROR_INVALID_ARGUMENT : RET_MSG_ERROR_INTERNAL;
+        goto finish;
+    }
+
+    if (update_volume_vconf(type, level) != 0) {
+        ret = RET_MSG_ERROR_INTERNAL;
+        pa_log_error("Failed to update volume vconf, rollback to old level[%u]", old_level);
+        set_volume_level_by_type(m, stream_type, type, old_level);
+    }
 
 finish:
     pa_dbus_send_basic_value_reply(conn, msg, DBUS_TYPE_STRING, &stream_manager_dbus_ret_str[ret]);
 
-    if (ret == 0)
+    if (ret == RET_MSG_OK)
         send_volume_changed_signal(conn, direction, type, level);
 }