[pulseaudio-commits] 2 commits - src/modules
Arun Raghavan
arun at kemper.freedesktop.org
Mon Aug 29 09:14:09 PDT 2011
src/modules/echo-cancel/module-echo-cancel.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
New commits:
commit 837ac4c225929ebe2f2a5866b9ccebd74ba587d1
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date: Mon Aug 29 17:47:39 2011 +0530
echo-cancel: Don't allow streams to attach while unloading
When unloading, some module may end up trin to move a sink-input or
source-output back onto our virtual sink/source, causing an infinite
loop of us moving the stream away and having it moved back.
We prevent this from happening by preventing any stream from being
attached during unload.
diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index 706f2e7..acfbc04 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -156,6 +156,7 @@ struct userdata {
pa_module *module;
pa_bool_t autoloaded;
+ pa_bool_t dead;
pa_bool_t save_aec;
pa_echo_canceller *ec;
@@ -1162,6 +1163,8 @@ static void source_output_kill_cb(pa_source_output *o) {
pa_assert_ctl_context();
pa_assert_se(u = o->userdata);
+ u->dead = TRUE;
+
/* The order here matters! We first kill the source output, followed
* by the source. That means the source callbacks must be protected
* against an unconnected source output! */
@@ -1186,6 +1189,8 @@ static void sink_input_kill_cb(pa_sink_input *i) {
pa_sink_input_assert_ref(i);
pa_assert_se(u = i->userdata);
+ u->dead = TRUE;
+
/* The order here matters! We first kill the sink input, followed
* by the sink. That means the sink callbacks must be protected
* against an unconnected sink input! */
@@ -1211,6 +1216,9 @@ static pa_bool_t source_output_may_move_to_cb(pa_source_output *o, pa_source *de
pa_assert_ctl_context();
pa_assert_se(u = o->userdata);
+ if (u->dead)
+ return FALSE;
+
return (u->source != dest) && (u->sink != dest->monitor_of);
}
@@ -1221,6 +1229,9 @@ static pa_bool_t sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) {
pa_sink_input_assert_ref(i);
pa_assert_se(u = i->userdata);
+ if (u->dead)
+ return FALSE;
+
return u->sink != dest;
}
@@ -1362,6 +1373,7 @@ int pa__init(pa_module*m) {
u->core = m->core;
u->module = m;
m->userdata = u;
+ u->dead = FALSE;
u->ec = pa_xnew0(pa_echo_canceller, 1);
if (!u->ec) {
@@ -1649,6 +1661,8 @@ void pa__done(pa_module*m) {
if (!(u = m->userdata))
return;
+ u->dead = TRUE;
+
/* See comments in source_output_kill_cb() above regarding
* destruction order! */
commit fe52c351c3890a6464eef1fd2185234577e3d149
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date: Mon Aug 29 17:47:27 2011 +0530
echo-cancel: Make save_aec modarg a bool instead of an int
diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index 62905bd..706f2e7 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -103,7 +103,7 @@ static const pa_echo_canceller ec_table[] = {
#define DEFAULT_RATE 32000
#define DEFAULT_CHANNELS 1
#define DEFAULT_ADJUST_TIME_USEC (1*PA_USEC_PER_SEC)
-#define DEFAULT_SAVE_AEC 0
+#define DEFAULT_SAVE_AEC FALSE
#define DEFAULT_AUTOLOADED FALSE
#define MEMBLOCKQ_MAXLENGTH (16*1024*1024)
@@ -156,7 +156,7 @@ struct userdata {
pa_module *module;
pa_bool_t autoloaded;
- uint32_t save_aec;
+ pa_bool_t save_aec;
pa_echo_canceller *ec;
uint32_t blocksize;
@@ -1390,7 +1390,7 @@ int pa__init(pa_module*m) {
u->adjust_time = DEFAULT_ADJUST_TIME_USEC;
u->save_aec = DEFAULT_SAVE_AEC;
- if (pa_modargs_get_value_u32(ma, "save_aec", &u->save_aec) < 0) {
+ if (pa_modargs_get_value_boolean(ma, "save_aec", &u->save_aec) < 0) {
pa_log("Failed to parse save_aec value");
goto fail;
}
More information about the pulseaudio-commits
mailing list