summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2010-08-24 11:46:18 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2010-09-02 17:31:36 +0200
commitc3cc461bf5b2f65f257c4017226c6693c1570885 (patch)
treeb2a5c2f67185c22ca2b0c4c5eae17225296fd085 /src/modules
parent95bdf675006dbd60eda7a88f17c5684c4f964f50 (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.
Diffstat (limited to 'src/modules')
-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 */