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;
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]);