sink-input/source-output: Don't crash when cork() is called without valid sink or source

If pa_sink_input_cork() or pa_source_output_cork() were called without a sink
or source attached, the calls would crash pulseaudio.

This patch fixes the problem, so that a source output or sink input can still
be corked or uncorked while source or sink are invalid. This is needed to
correct the corking logic in module-loopback.
This commit is contained in:
Georg Chini 2017-03-29 07:10:28 +02:00
parent cb78d6f57c
commit 3650346f70
15 changed files with 57 additions and 43 deletions

View file

@ -860,7 +860,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
/* If we are added for the first time, ask for a rewinding so that
* we are heard right-away. */
if (PA_SINK_INPUT_IS_LINKED(state) &&
i->thread_info.state == PA_SINK_INPUT_INIT) {
i->thread_info.state == PA_SINK_INPUT_INIT && i->sink) {
pa_log_debug("Requesting rewind due to state change.");
pa_sink_input_request_rewind(i, 0, false, true, true);
}