summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2010-08-24 13:29:18 +0200
committerArun Raghavan <arun.raghavan@collabora.co.uk>2011-03-28 14:40:59 +0530
commit1c2669452b325eb59ebfdfb955c187a2b7e8a7f0 (patch)
treea284925091b9d672225044284aac4ef571c10a40
parentde6cdf94878902e2339e0be55abb2a41dce519bf (diff)
echo-cancel: improve debug
-rw-r--r--src/modules/module-echo-cancel.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/modules/module-echo-cancel.c b/src/modules/module-echo-cancel.c
index 0abee55c..4d44bf73 100644
--- a/src/modules/module-echo-cancel.c
+++ b/src/modules/module-echo-cancel.c
@@ -267,17 +267,15 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim
base_rate = u->source_output->sample_spec.rate;
if (diff_time < 0) {
- pa_log_info("Playback after capture (%lld), realign", (long long) diff_time);
- pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->source_output), SOURCE_OUTPUT_MESSAGE_APPLY_DIFF_TIME,
- NULL, diff_time, NULL, NULL);
/* recording before playback, we need to adjust quickly. The echo
* canceler does not work in this case. */
+ pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->source_output), SOURCE_OUTPUT_MESSAGE_APPLY_DIFF_TIME,
+ NULL, diff_time, NULL, NULL);
//new_rate = base_rate - ((pa_usec_to_bytes (-diff_time, &u->source_output->sample_spec) / fs) * PA_USEC_PER_SEC) / u->adjust_time;
new_rate = base_rate;
}
else {
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,
NULL, diff_time, NULL, NULL);
@@ -575,17 +573,21 @@ static void apply_diff_time(struct userdata *u, int64_t diff_time) {
if (diff_time < 0) {
diff = pa_usec_to_bytes (-diff_time, &u->source_output->sample_spec);
- pa_log_debug("drop sink (%lld)", (long long) diff);
+ if (diff > 0) {
+ pa_log_info("Playback after capture (%lld), drop sink %lld", (long long) diff_time, (long long) diff);
- /* go forwards on the read side */
- pa_memblockq_drop(u->sink_memblockq, diff);
- } else {
+ /* go forwards on the read side */
+ pa_memblockq_drop(u->sink_memblockq, diff);
+ }
+ } else if (diff_time > 0) {
diff = pa_usec_to_bytes (diff_time, &u->source_output->sample_spec);
- pa_log_debug("drop source (%lld)", (long long) diff);
+ if (diff > 0) {
+ pa_log_info("playback too far ahead (%lld), drop source %lld", (long long) diff_time, (long long) diff);
- /* go back on the read side */
- pa_memblockq_rewind(u->sink_memblockq, diff);
+ /* go back on the read side */
+ pa_memblockq_rewind(u->sink_memblockq, diff);
+ }
}
}