Summary: | pulseaudio-12.0/src/pulsecore/sink-input.c:2017: confused logic ? | ||
---|---|---|---|
Product: | PulseAudio | Reporter: | dcb314 |
Component: | core | Assignee: | pulseaudio-bugs |
Status: | RESOLVED FIXED | QA Contact: | pulseaudio-bugs |
Severity: | normal | ||
Priority: | medium | CC: | lennart |
Version: | unspecified | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
dcb314
2018-06-21 07:25:22 UTC
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. I submitted a patch: https://patchwork.freedesktop.org/patch/232141/ The fix is in master now. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.