summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2010-08-24 11:46:18 +0200
committerArun Raghavan <arun.raghavan@collabora.co.uk>2011-03-28 14:40:59 +0530
commitde6cdf94878902e2339e0be55abb2a41dce519bf (patch)
treed5637ae2d5e98f6a29b3e1c3a56451be72eea804
parent7b972f5a4523d166df1f2d933502e08d9f16dd4d (diff)
echo-cancel: tweak the resync code a little
Try to keep the drift between source and sink within 4ms now that we have more accurate timings. Don't force a resync on latency changes but let the drift code handle it.
-rw-r--r--src/modules/module-echo-cancel.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/modules/module-echo-cancel.c b/src/modules/module-echo-cancel.c
index 7213e36c..0abee55c 100644
--- a/src/modules/module-echo-cancel.c
+++ b/src/modules/module-echo-cancel.c
@@ -276,7 +276,7 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim
new_rate = base_rate;
}
else {
- if (diff_time > (u->frame_size_ms / 2) * 1000) {
+ if (diff_time > 4000) {
pa_log_info("playback too far ahead (%lld), realign", (long long) diff_time);
/* diff too big, quickly adjust */
pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->source_output), SOURCE_OUTPUT_MESSAGE_APPLY_DIFF_TIME,
@@ -627,9 +627,8 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk)
;
u->in_push = FALSE;
- if (pa_atomic_load (&u->request_resync) == 1) {
+ if (pa_atomic_cmpxchg (&u->request_resync, 1, 0)) {
do_resync (u);
- pa_atomic_store (&u->request_resync, 0);
}
pa_memblockq_push_align(u->source_memblockq, chunk);
@@ -920,7 +919,6 @@ static void sink_input_update_sink_requested_latency_cb(pa_sink_input *i) {
latency = pa_sink_get_requested_latency_within_thread(i->sink);
pa_log_debug("Sink input update requested latency %lld", (long long) latency);
- pa_atomic_store (&u->request_resync, 1);
}
/* Called from I/O thread context */
@@ -934,7 +932,6 @@ static void source_output_update_source_requested_latency_cb(pa_source_output *o
latency = pa_source_get_requested_latency_within_thread(o->source);
pa_log_debug("source output update requested latency %lld", (long long) latency);
- pa_atomic_store (&u->request_resync, 1);
}
/* Called from I/O thread context */