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

@ -222,12 +222,11 @@ static void source_output_kill_cb(pa_source_output *o) {
pa_module_unload_request(u->module, true);
}
/* Called from output thread context */
/* Called from output thread context except when cork() is called without valid source. */
static void source_output_state_change_cb(pa_source_output *o, pa_source_output_state_t state) {
struct userdata *u;
pa_source_output_assert_ref(o);
pa_source_output_assert_io_context(o);
pa_assert_se(u = o->userdata);
pa_log_debug("Source output %d state %d.", o->index, state);