modules/audio_processing: Adds a config for reported delays
There are platforms and devices where the reported delays are untrusted and we currently solve that with an extended filter length and a slightly more conservative delay handling. With this change we give the user the possibility to turn off reported system delay values completely. - Includes new unit tests. TESTED=trybots and manual testing R=aluebs@webrtc.org, kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/13629004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6391 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
e61b8e32d8
commit
3f83072c26
@ -323,6 +323,7 @@ int EchoCancellationImpl::Initialize() {
|
||||
|
||||
void EchoCancellationImpl::SetExtraOptions(const Config& config) {
|
||||
delay_correction_enabled_ = config.Get<DelayCorrection>().enabled;
|
||||
reported_delay_enabled_ = config.Get<ReportedDelay>().enabled;
|
||||
Configure();
|
||||
}
|
||||
|
||||
|
@ -48,4 +48,34 @@ TEST(EchoCancellationInternalTest, DelayCorrection) {
|
||||
EXPECT_EQ(0, WebRtcAec_delay_correction_enabled(aec_core));
|
||||
}
|
||||
|
||||
TEST(EchoCancellationInternalTest, ReportedDelay) {
|
||||
scoped_ptr<AudioProcessing> ap(AudioProcessing::Create(0));
|
||||
EXPECT_TRUE(ap->echo_cancellation()->aec_core() == NULL);
|
||||
|
||||
EXPECT_EQ(ap->kNoError, ap->echo_cancellation()->Enable(true));
|
||||
EXPECT_TRUE(ap->echo_cancellation()->is_enabled());
|
||||
|
||||
AecCore* aec_core = ap->echo_cancellation()->aec_core();
|
||||
ASSERT_TRUE(aec_core != NULL);
|
||||
// Enabled by default.
|
||||
EXPECT_EQ(1, WebRtcAec_reported_delay_enabled(aec_core));
|
||||
|
||||
Config config;
|
||||
config.Set<ReportedDelay>(new ReportedDelay(false));
|
||||
ap->SetExtraOptions(config);
|
||||
EXPECT_EQ(0, WebRtcAec_reported_delay_enabled(aec_core));
|
||||
|
||||
// Retains setting after initialization.
|
||||
EXPECT_EQ(ap->kNoError, ap->Initialize());
|
||||
EXPECT_EQ(0, WebRtcAec_reported_delay_enabled(aec_core));
|
||||
|
||||
config.Set<ReportedDelay>(new ReportedDelay(true));
|
||||
ap->SetExtraOptions(config);
|
||||
EXPECT_EQ(1, WebRtcAec_reported_delay_enabled(aec_core));
|
||||
|
||||
// Retains setting after initialization.
|
||||
EXPECT_EQ(ap->kNoError, ap->Initialize());
|
||||
EXPECT_EQ(1, WebRtcAec_reported_delay_enabled(aec_core));
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -53,6 +53,18 @@ struct DelayCorrection {
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
// Use to disable the reported system delays. By disabling the reported system
|
||||
// delays the echo cancellation algorithm assumes the process and reverse
|
||||
// streams to be aligned. This configuration only applies to EchoCancellation
|
||||
// and not EchoControlMobile and is set with AudioProcessing::SetExtraOptions().
|
||||
// Note that by disabling reported system delays the EchoCancellation may
|
||||
// regress in performance.
|
||||
struct ReportedDelay {
|
||||
ReportedDelay() : enabled(true) {}
|
||||
explicit ReportedDelay(bool enabled) : enabled(enabled) {}
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
// Must be provided through AudioProcessing::Create(Confg&). It will have no
|
||||
// impact if used with AudioProcessing::SetExtraOptions().
|
||||
struct ExperimentalAgc {
|
||||
|
Loading…
Reference in New Issue
Block a user