mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
echo-cancel: Fix segfault during profile switch
When module-echo-cancel is loaded and there is only one sound card, then during a profile switch, all sinks and sources can become temporarily unavailable. If module-always sink is loaded, it will load a null-sink in that situation. If also module-switch-on-connect is loaded, it will try to move the sink-inputs to the new null-sink. If a sink-input was connected to the echo-cancel sink, pa_sink_input_start_move() will send a PA_SINK_GET_LATENCY message to the echo-cancel sink. The message handler will then in turn call pa_sink_get_latency_within_thread() for the invalid master sink of module-echo-cancel. This lead to a segfault. This patch checks in the message handler if the master sink (or source) is valid and returns 0 if not.
This commit is contained in:
parent
15b0b60aae
commit
3bb94c4e83
1 changed files with 4 additions and 2 deletions
|
|
@ -409,7 +409,8 @@ static int source_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t
|
||||||
* make sure we don't access it in that time. Also, the
|
* make sure we don't access it in that time. Also, the
|
||||||
* source output is first shut down, the source second. */
|
* source output is first shut down, the source second. */
|
||||||
if (!PA_SOURCE_IS_LINKED(u->source->thread_info.state) ||
|
if (!PA_SOURCE_IS_LINKED(u->source->thread_info.state) ||
|
||||||
!PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->thread_info.state)) {
|
!PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->thread_info.state) ||
|
||||||
|
!u->source_output->source) {
|
||||||
*((int64_t*) data) = 0;
|
*((int64_t*) data) = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -445,7 +446,8 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t of
|
||||||
* make sure we don't access it in that time. Also, the
|
* make sure we don't access it in that time. Also, the
|
||||||
* sink input is first shut down, the sink second. */
|
* sink input is first shut down, the sink second. */
|
||||||
if (!PA_SINK_IS_LINKED(u->sink->thread_info.state) ||
|
if (!PA_SINK_IS_LINKED(u->sink->thread_info.state) ||
|
||||||
!PA_SINK_INPUT_IS_LINKED(u->sink_input->thread_info.state)) {
|
!PA_SINK_INPUT_IS_LINKED(u->sink_input->thread_info.state) ||
|
||||||
|
!u->sink_input->sink) {
|
||||||
*((int64_t*) data) = 0;
|
*((int64_t*) data) = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue