suspend: Do not assert when checking for device suspended status and a stream is not linked.

When looping through the streams on a given device checking to see if the
stream is 'active' there should be no assert if the stream is not linked, it
should simply be ignored.

This assert can be hit if a sink and a sink input are both created and setup
but the final put calls are left to the end as is done in module-ladspa-sink.

While the order of the calls in module-ladspa-sink could be altered, we should
deal gracefully with the way it is now and not complain about ending up
in this state.

A trigger case was trivial:
 1. Load a ladspa-sink.
 2. Play a stream and move it to it.
 3. Unload the module, then reload it.
 4. Due to module-stream-restore and module-suspend-on-idle, the hook callbacks
    will ultimately hit this assert.

Thanks to Kim Therkelsen for highlighting this issue.
This commit is contained in:
Colin Guthrie 2010-10-01 01:26:43 +01:00
parent b02abcb613
commit d195a54979
2 changed files with 16 additions and 2 deletions

View file

@ -1763,7 +1763,14 @@ unsigned pa_sink_check_suspend(pa_sink *s) {
pa_sink_input_state_t st;
st = pa_sink_input_get_state(i);
pa_assert(PA_SINK_INPUT_IS_LINKED(st));
/* We do not assert here. It is perfectly valid for a sink input to
* be in the INIT state (i.e. created, marked done but not yet put)
* and we should not care if it's unlinked as it won't contribute
* towarards our busy status.
*/
if (!PA_SINK_INPUT_IS_LINKED(st))
continue;
if (st == PA_SINK_INPUT_CORKED)
continue;

View file

@ -996,7 +996,14 @@ unsigned pa_source_check_suspend(pa_source *s) {
pa_source_output_state_t st;
st = pa_source_output_get_state(o);
pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(st));
/* We do not assert here. It is perfectly valid for a source output to
* be in the INIT state (i.e. created, marked done but not yet put)
* and we should not care if it's unlinked as it won't contribute
* towarards our busy status.
*/
if (!PA_SOURCE_OUTPUT_IS_LINKED(st))
continue;
if (st == PA_SOURCE_OUTPUT_CORKED)
continue;