[pulseaudio-commits] 2 commits - src/modules
Georg Chini
gchini at kemper.freedesktop.org
Mon Apr 24 18:34:34 UTC 2017
src/modules/echo-cancel/module-echo-cancel.c | 6 ++++--
src/modules/module-ladspa-sink.c | 3 ++-
src/modules/module-remap-sink.c | 3 ++-
src/modules/module-remap-source.c | 3 ++-
src/modules/module-virtual-sink.c | 3 ++-
src/modules/module-virtual-source.c | 3 ++-
src/modules/module-virtual-surround-sink.c | 3 ++-
7 files changed, 16 insertions(+), 8 deletions(-)
New commits:
commit db4fbb0121a2577d786cda023a6a439a9734f152
Author: Georg Chini <georg at chini.tk>
Date: Mon Apr 24 20:31:54 2017 +0200
virtual sources and sinks: Fix possible segfault
Several virtual sources and sinks apart from module-echo-cancel also query the master
sink or source to estimate the current latency. Those modules might potentially show
the bug that is described for module-echo-cancel in bug 100277.
This patch checks in the message handlers for the PA_{SINK,SOURCE}_MESSAGE_GET_LATENCY
if the master sink or source is valid and returns 0 as latency if not. This is however
not yet sufficient to solve the issue. Additional patches will follow.
diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c
index 7b2e651f..86ab4a6f 100644
--- a/src/modules/module-ladspa-sink.c
+++ b/src/modules/module-ladspa-sink.c
@@ -347,7 +347,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
* sink input is first shut down, the sink second. */
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;
return 0;
}
diff --git a/src/modules/module-remap-sink.c b/src/modules/module-remap-sink.c
index 37f4f56c..534874d7 100644
--- a/src/modules/module-remap-sink.c
+++ b/src/modules/module-remap-sink.c
@@ -83,7 +83,8 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
/* The sink is _put() before the sink input is, so let's
* make sure we don't access it yet */
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;
return 0;
}
diff --git a/src/modules/module-remap-source.c b/src/modules/module-remap-source.c
index 0bdeb381..25772ecd 100644
--- a/src/modules/module-remap-source.c
+++ b/src/modules/module-remap-source.c
@@ -91,7 +91,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
* source output is first shut down, the source second. */
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;
return 0;
}
diff --git a/src/modules/module-virtual-sink.c b/src/modules/module-virtual-sink.c
index 4fa4a56e..6175ca8e 100644
--- a/src/modules/module-virtual-sink.c
+++ b/src/modules/module-virtual-sink.c
@@ -94,7 +94,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
* sink input is first shut down, the sink second. */
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;
return 0;
}
diff --git a/src/modules/module-virtual-source.c b/src/modules/module-virtual-source.c
index 42aefd05..dd0b40e1 100644
--- a/src/modules/module-virtual-source.c
+++ b/src/modules/module-virtual-source.c
@@ -175,7 +175,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
* source output is first shut down, the source second. */
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) {
*((pa_usec_t*) data) = 0;
return 0;
}
diff --git a/src/modules/module-virtual-surround-sink.c b/src/modules/module-virtual-surround-sink.c
index 23c6bdc5..94ea9f4a 100644
--- a/src/modules/module-virtual-surround-sink.c
+++ b/src/modules/module-virtual-surround-sink.c
@@ -122,7 +122,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
* sink input is first shut down, the sink second. */
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;
return 0;
}
commit 3bb94c4e836ca765a36255e416fd8e6cf272ab44
Author: Georg Chini <georg at chini.tk>
Date: Mon Apr 24 20:30:48 2017 +0200
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.
diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index 04984f32..7e7290e6 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -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
* source output is first shut down, the source second. */
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;
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
* sink input is first shut down, the sink second. */
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;
return 0;
}
More information about the pulseaudio-commits
mailing list