mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-19 08:57:00 -05:00
esound,streams: Fix some crashes.
After the rework to the add pa_sink_input_new_data_set_sink() (and the source equiv) calling with a NULL sink object will hit an assert. This caused crashes with the esd protocol and there was the potential (albeit unlikely) for a crash when creating a sink input without any sinks available (module-always-sink mitigates this risk but it's still a potential crasher).
This commit is contained in:
parent
32927c50a8
commit
ec4fa4c668
3 changed files with 14 additions and 9 deletions
|
|
@ -273,9 +273,11 @@ int pa_sink_input_new(
|
|||
|
||||
pa_return_val_if_fail(!data->driver || pa_utf8_valid(data->driver), -PA_ERR_INVALID);
|
||||
|
||||
if (!data->sink)
|
||||
pa_sink_input_new_data_set_sink(data, pa_namereg_get(core, NULL, PA_NAMEREG_SINK), FALSE);
|
||||
|
||||
if (!data->sink) {
|
||||
pa_sink *sink = pa_namereg_get(core, NULL, PA_NAMEREG_SINK);
|
||||
pa_return_val_if_fail(sink, -PA_ERR_NOENTITY);
|
||||
pa_sink_input_new_data_set_sink(data, sink, FALSE);
|
||||
}
|
||||
/* Routing's done, we have a sink. Now let's fix the format and set up the
|
||||
* sample spec */
|
||||
|
||||
|
|
@ -298,7 +300,6 @@ int pa_sink_input_new(
|
|||
pa_sink_input_new_data_set_sample_spec(data, &ss);
|
||||
}
|
||||
|
||||
pa_return_val_if_fail(data->sink, -PA_ERR_NOENTITY);
|
||||
pa_return_val_if_fail(PA_SINK_IS_LINKED(pa_sink_get_state(data->sink)), -PA_ERR_BADSTATE);
|
||||
pa_return_val_if_fail(!data->sync_base || (data->sync_base->sink == data->sink && pa_sink_input_get_state(data->sync_base) == PA_SINK_INPUT_CORKED), -PA_ERR_INVALID);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue