summaryrefslogtreecommitdiff
path: root/modules/audio_processing/aec/echo_cancellation.c
diff options
context:
space:
mode:
authorandrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-10-01 01:12:25 +0000
committerandrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-10-01 01:12:25 +0000
commit37da9ab85b0b710b6786e90704a82d4415b6a7ee (patch)
tree19c9450e174539802977884fcdb604784650edc5 /modules/audio_processing/aec/echo_cancellation.c
parent0e9c399746f45ceaf46f12b11ba93c09cca0c2bb (diff)
downloadwebrtc-37da9ab85b0b710b6786e90704a82d4415b6a7ee.tar.gz
Ensure adjusted "known delay" doesn't drop below zero.
The untrusted delay mode provides an option to reduce the "known delay" parameter passed down to the core AEC. This is necessary to handle the very low latencies observed with the Chromium audio backend on Mac. Prior to this change, it was possible to pass a negative value. The AEC produced good output in practice, but it turned out this tripped a heretofore unnoticed assert in ProcessBlock(). This change avoids the assert, and maintains the good output across a set of Mac recordings. Bit-exact in some cases, and in the remaining, quickly converging to identical output. The assert was hit on the last webrtc roll in Chromium in content_browsertests on Mac. Corresponds to: https://chromereviews.googleplex.com/9960013 TBR=bjornv TESTED=Verified locally that "content_browsertests --gtest_filter=WebrtcBrowserTest.*"" passes. Review URL: https://webrtc-codereview.appspot.com/2328005 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@4886 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'modules/audio_processing/aec/echo_cancellation.c')
-rw-r--r--modules/audio_processing/aec/echo_cancellation.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/modules/audio_processing/aec/echo_cancellation.c b/modules/audio_processing/aec/echo_cancellation.c
index 07bca559..27da67de 100644
--- a/modules/audio_processing/aec/echo_cancellation.c
+++ b/modules/audio_processing/aec/echo_cancellation.c
@@ -814,13 +814,18 @@ static void ProcessExtended(aecpc_t* self, const int16_t* near,
EstBufDelayExtended(self);
- for (i = 0; i < num_frames; ++i) {
+ {
// |delay_diff_offset| gives us the option to manually rewind the delay on
// very low delay platforms which can't be expressed purely through
// |reported_delay_ms|.
- WebRtcAec_ProcessFrame(self->aec, &near[FRAME_LEN * i],
- &near_high[FRAME_LEN * i], self->knownDelay + delay_diff_offset,
- &out[FRAME_LEN * i], &out_high[FRAME_LEN * i]);
+ const int adjusted_known_delay =
+ WEBRTC_SPL_MAX(0, self->knownDelay + delay_diff_offset);
+
+ for (i = 0; i < num_frames; ++i) {
+ WebRtcAec_ProcessFrame(self->aec, &near[FRAME_LEN * i],
+ &near_high[FRAME_LEN * i], adjusted_known_delay,
+ &out[FRAME_LEN * i], &out_high[FRAME_LEN * i]);
+ }
}
}