Added boilerplate code for being able to test the upcoming
AEC functionality. BUG=webrtc:5201 Review URL: https://codereview.webrtc.org/1700703005 Cr-Commit-Position: refs/heads/master@{#11647}
This commit is contained in:
parent
0206000a66
commit
a332e2d3af
@ -31,7 +31,8 @@ enum class ConfigOptionID {
|
||||
kExperimentalAgc,
|
||||
kExperimentalNs,
|
||||
kBeamforming,
|
||||
kIntelligibility
|
||||
kIntelligibility,
|
||||
kNextGenerationAec
|
||||
};
|
||||
|
||||
// Class Config is designed to ease passing a set of options across webrtc code.
|
||||
|
||||
@ -1430,6 +1430,7 @@ AecCore* WebRtcAec_CreateAec() {
|
||||
WebRtc_set_lookahead(aec->delay_estimator, kLookaheadBlocks);
|
||||
#endif
|
||||
aec->extended_filter_enabled = 0;
|
||||
aec->next_generation_aec_enabled = 0;
|
||||
|
||||
// Assembly optimization
|
||||
WebRtcAec_FilterFar = FilterFar;
|
||||
@ -1863,6 +1864,17 @@ int WebRtcAec_delay_agnostic_enabled(AecCore* self) {
|
||||
return self->delay_agnostic_enabled;
|
||||
}
|
||||
|
||||
void WebRtcAec_enable_next_generation_aec(AecCore* self, int enable) {
|
||||
self->next_generation_aec_enabled = (enable != 0);
|
||||
}
|
||||
|
||||
int WebRtcAec_next_generation_aec_enabled(AecCore* self) {
|
||||
assert(self->next_generation_aec_enabled == 0 ||
|
||||
self->next_generation_aec_enabled == 1);
|
||||
return self->next_generation_aec_enabled;
|
||||
}
|
||||
|
||||
|
||||
void WebRtcAec_enable_extended_filter(AecCore* self, int enable) {
|
||||
self->extended_filter_enabled = enable;
|
||||
self->num_partitions = enable ? kExtendedNumPartitions : kNormalNumPartitions;
|
||||
|
||||
@ -111,6 +111,12 @@ void WebRtcAec_enable_delay_agnostic(AecCore* self, int enable);
|
||||
// enabled and zero if disabled.
|
||||
int WebRtcAec_delay_agnostic_enabled(AecCore* self);
|
||||
|
||||
// Non-zero enables, zero disables.
|
||||
void WebRtcAec_enable_next_generation_aec(AecCore* self, int enable);
|
||||
|
||||
// Returns 1 if the next generation aec is enabled and zero if disabled.
|
||||
int WebRtcAec_next_generation_aec_enabled(AecCore* self);
|
||||
|
||||
// Enables or disables extended filter mode. Non-zero enables, zero disables.
|
||||
void WebRtcAec_enable_extended_filter(AecCore* self, int enable);
|
||||
|
||||
|
||||
@ -145,6 +145,9 @@ struct AecCore {
|
||||
int delay_agnostic_enabled;
|
||||
// 1 = extended filter mode enabled, 0 = disabled.
|
||||
int extended_filter_enabled;
|
||||
// 1 = next generation aec mode enabled, 0 = disabled.
|
||||
int next_generation_aec_enabled;
|
||||
|
||||
// Runtime selection of number of filter partitions.
|
||||
int num_partitions;
|
||||
|
||||
|
||||
@ -77,6 +77,7 @@ EchoCancellationImpl::EchoCancellationImpl(const AudioProcessing* apm,
|
||||
delay_logging_enabled_(false),
|
||||
extended_filter_enabled_(false),
|
||||
delay_agnostic_enabled_(false),
|
||||
next_generation_aec_enabled_(false),
|
||||
render_queue_element_max_size_(0) {
|
||||
RTC_DCHECK(apm);
|
||||
RTC_DCHECK(crit_render);
|
||||
@ -356,6 +357,11 @@ bool EchoCancellationImpl::is_delay_agnostic_enabled() const {
|
||||
return delay_agnostic_enabled_;
|
||||
}
|
||||
|
||||
bool EchoCancellationImpl::is_next_generation_aec_enabled() const {
|
||||
rtc::CritScope cs(crit_capture_);
|
||||
return next_generation_aec_enabled_;
|
||||
}
|
||||
|
||||
bool EchoCancellationImpl::is_extended_filter_enabled() const {
|
||||
rtc::CritScope cs(crit_capture_);
|
||||
return extended_filter_enabled_;
|
||||
@ -447,6 +453,7 @@ void EchoCancellationImpl::SetExtraOptions(const Config& config) {
|
||||
rtc::CritScope cs(crit_capture_);
|
||||
extended_filter_enabled_ = config.Get<ExtendedFilter>().enabled;
|
||||
delay_agnostic_enabled_ = config.Get<DelayAgnostic>().enabled;
|
||||
next_generation_aec_enabled_ = config.Get<NextGenerationAec>().enabled;
|
||||
}
|
||||
Configure();
|
||||
}
|
||||
@ -486,6 +493,9 @@ int EchoCancellationImpl::ConfigureHandle(void* handle) const {
|
||||
WebRtcAec_enable_delay_agnostic(
|
||||
WebRtcAec_aec_core(static_cast<Handle*>(handle)),
|
||||
delay_agnostic_enabled_ ? 1 : 0);
|
||||
WebRtcAec_enable_next_generation_aec(
|
||||
WebRtcAec_aec_core(static_cast<Handle*>(handle)),
|
||||
next_generation_aec_enabled_ ? 1 : 0);
|
||||
return WebRtcAec_set_config(static_cast<Handle*>(handle), config);
|
||||
}
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ class EchoCancellationImpl : public EchoCancellation,
|
||||
void SetExtraOptions(const Config& config) override;
|
||||
bool is_delay_agnostic_enabled() const;
|
||||
bool is_extended_filter_enabled() const;
|
||||
bool is_next_generation_aec_enabled() const;
|
||||
|
||||
// Reads render side data that has been queued on the render call.
|
||||
// Called holding the capture lock.
|
||||
@ -92,6 +93,7 @@ class EchoCancellationImpl : public EchoCancellation,
|
||||
bool delay_logging_enabled_ GUARDED_BY(crit_capture_);
|
||||
bool extended_filter_enabled_ GUARDED_BY(crit_capture_);
|
||||
bool delay_agnostic_enabled_ GUARDED_BY(crit_capture_);
|
||||
bool next_generation_aec_enabled_ GUARDED_BY(crit_capture_);
|
||||
|
||||
size_t render_queue_element_max_size_ GUARDED_BY(crit_render_)
|
||||
GUARDED_BY(crit_capture_);
|
||||
|
||||
@ -69,6 +69,17 @@ struct ExtendedFilter {
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
// Enables the next generation AEC functionality. This feature replaces the
|
||||
// standard methods for echo removal in the AEC. This configuration only applies
|
||||
// to EchoCancellation and not EchoControlMobile. It can be set in the
|
||||
// constructor or using AudioProcessing::SetExtraOptions().
|
||||
struct NextGenerationAec {
|
||||
NextGenerationAec() : enabled(false) {}
|
||||
explicit NextGenerationAec(bool enabled) : enabled(enabled) {}
|
||||
static const ConfigOptionID identifier = ConfigOptionID::kNextGenerationAec;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
// Enables delay-agnostic echo cancellation. This feature relies on internally
|
||||
// estimated delays between the process and reverse streams, thus not relying
|
||||
// on reported system delays. This configuration only applies to
|
||||
|
||||
@ -81,6 +81,7 @@ void usage() {
|
||||
printf(" --aec_suppression_level LEVEL [0 - 2]\n");
|
||||
printf(" --extended_filter\n");
|
||||
printf(" --no_reported_delay\n");
|
||||
printf(" --next_generation_aec\n");
|
||||
printf("\n -aecm Echo control mobile\n");
|
||||
printf(" --aecm_echo_path_in_file FILE\n");
|
||||
printf(" --aecm_echo_path_out_file FILE\n");
|
||||
@ -267,6 +268,9 @@ void void_main(int argc, char* argv[]) {
|
||||
} else if (strcmp(argv[i], "--delay_agnostic") == 0) {
|
||||
config.Set<DelayAgnostic>(new DelayAgnostic(true));
|
||||
|
||||
} else if (strcmp(argv[i], "--next_generation_aec") == 0) {
|
||||
config.Set<NextGenerationAec>(new NextGenerationAec(true));
|
||||
|
||||
} else if (strcmp(argv[i], "-aecm") == 0) {
|
||||
ASSERT_EQ(apm->kNoError, apm->echo_control_mobile()->Enable(true));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user