[pulseaudio-tickets] [Bug 106982] pulseaudio-12.0/src/pulsecore/sink-input.c:2017: confused logic ?

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Jun 26 10:02:46 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=106982

--- Comment #1 from Tanu Kaskinen <tanuk at iki.fi> ---
This is ancient code, and I'm not sure what Lennart intended to do. I found
out, though, that neither state nor i->thread_info.state can ever be DRAINED,
so the code could be simplified to

    if (state == PA_SINK_INPUT_RUNNING && !(i->thread_info.state !=
PA_SINK_INPUT_RUNNING))

and that can be simplified to

    if (state == PA_SINK_INPUT_RUNNING && i->thread_info.state ==
PA_SINK_INPUT_RUNNING)

That condition is never true, because there's an earlier check:

if (state == i->thread_info.state)
    return;

I think the intent was to use == rather than != in the last comparison, so if
the state changes from non-running to running, then the sink input is marked as
drained.

In any case, the only purpose of the DRAINED state seems to be to show when the
sink input playback buffer is empty in the command line interface. In all other
contexts the DRAINED and RUNNING states are handled identically. I think the
usage doesn't justify the complexity, so I'll make a patch that removes the
DRAINED state altogether.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-bugs/attachments/20180626/bcd9fc5d/attachment.html>


More information about the pulseaudio-bugs mailing list