AEC: Adds a reported_delay_enabled_ flag
Adds a feature to completely turn on or off buffer handling based on reported delay values. During startup, reported delays are controlled differently through, e.g., WEBRTC_UNTRUSTED_DELAY. By default, the feature is enabled giving the same output as before this change. TESTED=trybots, modules_unittest R=aluebs@webrtc.org, andrew@webrtc.org, kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/12349005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5965 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
26e2b687fc
commit
e9d3760d5c
@ -473,6 +473,7 @@ int WebRtcAec_InitAec(AecCore* aec, int sampFreq) {
|
||||
aec->delay_logging_enabled = 0;
|
||||
memset(aec->delay_histogram, 0, sizeof(aec->delay_histogram));
|
||||
|
||||
aec->reported_delay_enabled = 1;
|
||||
aec->extended_filter_enabled = 0;
|
||||
aec->num_partitions = kNormalNumPartitions;
|
||||
|
||||
@ -785,6 +786,14 @@ void WebRtcAec_SetConfigCore(AecCore* self,
|
||||
}
|
||||
}
|
||||
|
||||
void WebRtcAec_enable_reported_delay(AecCore* self, int enable) {
|
||||
self->reported_delay_enabled = enable;
|
||||
}
|
||||
|
||||
int WebRtcAec_reported_delay_enabled(AecCore* self) {
|
||||
return self->reported_delay_enabled;
|
||||
}
|
||||
|
||||
void WebRtcAec_enable_delay_correction(AecCore* self, int enable) {
|
||||
self->extended_filter_enabled = enable;
|
||||
self->num_partitions = enable ? kExtendedNumPartitions : kNormalNumPartitions;
|
||||
|
@ -104,6 +104,12 @@ void WebRtcAec_SetConfigCore(AecCore* self,
|
||||
int metrics_mode,
|
||||
int delay_logging);
|
||||
|
||||
// Non-zero enables, zero disables.
|
||||
void WebRtcAec_enable_reported_delay(AecCore* self, int enable);
|
||||
|
||||
// Returns non-zero if reported delay is enabled and zero if disabled.
|
||||
int WebRtcAec_reported_delay_enabled(AecCore* self);
|
||||
|
||||
// We now interpret delay correction to mean an extended filter length feature.
|
||||
// We reuse the delay correction infrastructure to avoid changes through to
|
||||
// libjingle. See details along with |DelayCorrection| in
|
||||
|
@ -122,6 +122,7 @@ struct AecCore {
|
||||
void* delay_estimator_farend;
|
||||
void* delay_estimator;
|
||||
|
||||
int reported_delay_enabled; // 0 = disabled, otherwise enabled.
|
||||
// 1 = extended filter mode enabled, 0 = disabled.
|
||||
int extended_filter_enabled;
|
||||
// Runtime selection of number of filter partitions.
|
||||
|
@ -766,7 +766,9 @@ static int ProcessNormal(aecpc_t* aecpc,
|
||||
}
|
||||
} else {
|
||||
// AEC is enabled.
|
||||
EstBufDelayNormal(aecpc);
|
||||
if (WebRtcAec_reported_delay_enabled(aecpc->aec)) {
|
||||
EstBufDelayNormal(aecpc);
|
||||
}
|
||||
|
||||
// Note that 1 frame is supported for NB and 2 frames for WB.
|
||||
for (i = 0; i < nFrames; i++) {
|
||||
@ -842,7 +844,9 @@ static void ProcessExtended(aecpc_t* self,
|
||||
self->startup_phase = 0;
|
||||
}
|
||||
|
||||
EstBufDelayExtended(self);
|
||||
if (WebRtcAec_reported_delay_enabled(self->aec)) {
|
||||
EstBufDelayExtended(self);
|
||||
}
|
||||
|
||||
{
|
||||
// |delay_diff_offset| gives us the option to manually rewind the delay on
|
||||
|
@ -67,7 +67,8 @@ EchoCancellationImpl::EchoCancellationImpl(const AudioProcessing* apm,
|
||||
was_stream_drift_set_(false),
|
||||
stream_has_echo_(false),
|
||||
delay_logging_enabled_(false),
|
||||
delay_correction_enabled_(false) {}
|
||||
delay_correction_enabled_(false),
|
||||
reported_delay_enabled_(true) {}
|
||||
|
||||
EchoCancellationImpl::~EchoCancellationImpl() {}
|
||||
|
||||
@ -361,6 +362,8 @@ int EchoCancellationImpl::ConfigureHandle(void* handle) const {
|
||||
|
||||
WebRtcAec_enable_delay_correction(WebRtcAec_aec_core(
|
||||
static_cast<Handle*>(handle)), delay_correction_enabled_ ? 1 : 0);
|
||||
WebRtcAec_enable_reported_delay(WebRtcAec_aec_core(
|
||||
static_cast<Handle*>(handle)), reported_delay_enabled_ ? 1 : 0);
|
||||
return WebRtcAec_set_config(static_cast<Handle*>(handle), config);
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,7 @@ class EchoCancellationImpl : public EchoCancellation,
|
||||
bool stream_has_echo_;
|
||||
bool delay_logging_enabled_;
|
||||
bool delay_correction_enabled_;
|
||||
bool reported_delay_enabled_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
Loading…
Reference in New Issue
Block a user