[pulseaudio-discuss] [PATCH] sink-input: Fix logical error in condition
Boris Egorov
egorov at linux.com
Wed Feb 25 02:42:46 PST 2015
Error: if thread_info.state is DRAINED, it cannot be equal to RUNNING.
So, part of condition is redundant or wrong. Original code looks
different from this (see commit 045c1d602dcba578), so it is most likely
wrong. We need to set thread_info.drained to 1 only if thread_info.state
is not DRAINED or RUNNING.
Issue detected by PVS Studio and Cppcheck.
Signed-off-by: Boris Egorov <egorov at linux.com>
---
src/pulsecore/sink-input.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index d95a93e..29beca6 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1876,7 +1876,7 @@ void pa_sink_input_set_state_within_thread(pa_sink_input *i, pa_sink_input_state
return;
if ((state == PA_SINK_INPUT_DRAINED || state == PA_SINK_INPUT_RUNNING) &&
- !(i->thread_info.state == PA_SINK_INPUT_DRAINED || i->thread_info.state != PA_SINK_INPUT_RUNNING))
+ !(i->thread_info.state == PA_SINK_INPUT_DRAINED || i->thread_info.state == PA_SINK_INPUT_RUNNING))
pa_atomic_store(&i->thread_info.drained, 1);
corking = state == PA_SINK_INPUT_CORKED && i->thread_info.state == PA_SINK_INPUT_RUNNING;
--
2.1.4
More information about the pulseaudio-discuss
mailing list