]> code.delx.au - pulseaudio/commitdiff
sink-input, source-output: Fix mute saving
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Tue, 15 Apr 2014 07:59:03 +0000 (10:59 +0300)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Sat, 26 Apr 2014 08:30:01 +0000 (11:30 +0300)
"i->save_muted = i->save_muted || mute" makes no sense. The intention
was most likely to use "save" instead of "mute" in the assignment.
This line originates from reverting the volume ramping code, commit
8401572fd534f10e07ed6a418e1399b1294d5596.

The idea of "i->save_muted |= save" is that even if the mute state
doesn't change, save_muted should still be updated, but only if the
transition is from "don't save" to "save".

Changing "!i->muted == !mute" to "mute == i->muted" is cosmetic only.
The rationale behind the old form was probably that when we still had
pa_bool_t, booleans could in theory be defined as int, so comparing
the values without the ! operator was not entirely safe. That's
unnecessary now that we use the standard bool type, which can only
have values 0 or 1.

src/pulsecore/sink-input.c
src/pulsecore/source-output.c

index b9264419b7d943e7b80bf22a8e6de954f20a3fea..4d685c366b75ed6d96d2b7be7aa99f51b9dfc07a 100644 (file)
@@ -1410,8 +1410,8 @@ void pa_sink_input_set_mute(pa_sink_input *i, bool mute, bool save) {
     pa_assert_ctl_context();
     pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
 
-    if (!i->muted == !mute) {
-        i->save_muted = i->save_muted || mute;
+    if (mute == i->muted) {
+        i->save_muted |= save;
         return;
     }
 
index 4e4b7e98f184c9a5a4fe4fa25e1b2dfca39b41b1..34a4cb022881f604c4c8a1f6d849e0a1e6974ddc 100644 (file)
@@ -1061,8 +1061,8 @@ void pa_source_output_set_mute(pa_source_output *o, bool mute, bool save) {
     pa_assert_ctl_context();
     pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state));
 
-    if (!o->muted == !mute) {
-        o->save_muted = o->save_muted || mute;
+    if (mute == o->muted) {
+        o->save_muted |= save;
         return;
     }