From 7789fe7ab1283fb4cbf6fa26d445b748d10928a7 Mon Sep 17 00:00:00 2001 From: peah Date: Fri, 15 Apr 2016 01:19:44 -0700 Subject: [PATCH] Added a protobuf field for the audio processing module to store the status of temporary experimental features that are active in the module and its submodules. BUG=webrtc:5778, webrtc:5777 Review URL: https://codereview.webrtc.org/1886233003 Cr-Commit-Position: refs/heads/master@{#12371} --- .../audio_processing/audio_processing_impl.cc | 6 +++ webrtc/modules/audio_processing/debug.proto | 5 ++- .../echo_cancellation_impl.cc | 5 +++ .../audio_processing/echo_cancellation_impl.h | 1 + .../audio_processing/test/debug_dump_test.cc | 45 +++++++++++++++++++ .../modules/audio_processing/test/unpack.cc | 4 ++ 6 files changed, 65 insertions(+), 1 deletion(-) diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc index a65598c3e4..3a83d1c2d6 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.cc +++ b/webrtc/modules/audio_processing/audio_processing_impl.cc @@ -1439,6 +1439,12 @@ int AudioProcessingImpl::WriteConfigMessage(bool forced) { config.set_transient_suppression_enabled( capture_.transient_suppressor_enabled); + std::string experiments_description = + public_submodules_->echo_cancellation->GetExperimentsDescription(); + // TODO(peah): Add semicolon-separated concatenations of experiment + // descriptions for other submodules. + config.set_experiments_description(experiments_description); + std::string serialized_config = config.SerializeAsString(); if (!forced && debug_dump_.capture.last_serialized_config == serialized_config) { diff --git a/webrtc/modules/audio_processing/debug.proto b/webrtc/modules/audio_processing/debug.proto index dea8fff1d1..f79674427e 100644 --- a/webrtc/modules/audio_processing/debug.proto +++ b/webrtc/modules/audio_processing/debug.proto @@ -46,7 +46,7 @@ message Stream { // Contains the configurations of various APM component. A Config message is // added when any of the fields are changed. message Config { - // Next field number 17. + // Next field number 18. // Acoustic echo canceler. optional bool aec_enabled = 1; optional bool aec_delay_agnostic_enabled = 2; @@ -69,6 +69,9 @@ message Config { optional int32 ns_level = 15; // Transient suppression. optional bool transient_suppression_enabled = 16; + // Semicolon-separated string containing experimental feature + // descriptions. + optional string experiments_description = 17; } message Event { diff --git a/webrtc/modules/audio_processing/echo_cancellation_impl.cc b/webrtc/modules/audio_processing/echo_cancellation_impl.cc index 810ea89655..12ea75efe1 100644 --- a/webrtc/modules/audio_processing/echo_cancellation_impl.cc +++ b/webrtc/modules/audio_processing/echo_cancellation_impl.cc @@ -413,6 +413,11 @@ bool EchoCancellationImpl::is_aec3_enabled() const { return aec3_enabled_; } +std::string EchoCancellationImpl::GetExperimentsDescription() { + rtc::CritScope cs(crit_capture_); + return aec3_enabled_ ? "AEC3" : ""; +} + bool EchoCancellationImpl::is_extended_filter_enabled() const { rtc::CritScope cs(crit_capture_); return extended_filter_enabled_; diff --git a/webrtc/modules/audio_processing/echo_cancellation_impl.h b/webrtc/modules/audio_processing/echo_cancellation_impl.h index 813019f424..b58ba596ea 100644 --- a/webrtc/modules/audio_processing/echo_cancellation_impl.h +++ b/webrtc/modules/audio_processing/echo_cancellation_impl.h @@ -47,6 +47,7 @@ class EchoCancellationImpl : public EchoCancellation { bool is_delay_agnostic_enabled() const; bool is_extended_filter_enabled() const; bool is_aec3_enabled() const; + std::string GetExperimentsDescription(); // Checks whether the module is enabled. Must only be // called from the render side of APM as otherwise diff --git a/webrtc/modules/audio_processing/test/debug_dump_test.cc b/webrtc/modules/audio_processing/test/debug_dump_test.cc index b16144b125..60c1eb9511 100644 --- a/webrtc/modules/audio_processing/test/debug_dump_test.cc +++ b/webrtc/modules/audio_processing/test/debug_dump_test.cc @@ -341,6 +341,51 @@ TEST_F(DebugDumpTest, ToggleDelayAgnosticAec) { VerifyDebugDump(generator.dump_file_name()); } +TEST_F(DebugDumpTest, VerifyAec3ExperimentalString) { + Config config; + config.Set(new EchoCanceller3(true)); + DebugDumpGenerator generator(config); + generator.StartRecording(); + generator.Process(100); + generator.StopRecording(); + + DebugDumpReplayer debug_dump_replayer_; + + ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); + + while (const rtc::Optional event = + debug_dump_replayer_.GetNextEvent()) { + debug_dump_replayer_.RunNextEvent(); + if (event->type() == audioproc::Event::CONFIG) { + const audioproc::Config* msg = &event->config(); + EXPECT_TRUE(msg->has_experiments_description()); + EXPECT_NE(std::string::npos, msg->experiments_description().find("AEC3")); + } + } +} + +TEST_F(DebugDumpTest, VerifyEmptyExperimentalString) { + Config config; + DebugDumpGenerator generator(config); + generator.StartRecording(); + generator.Process(100); + generator.StopRecording(); + + DebugDumpReplayer debug_dump_replayer_; + + ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name())); + + while (const rtc::Optional event = + debug_dump_replayer_.GetNextEvent()) { + debug_dump_replayer_.RunNextEvent(); + if (event->type() == audioproc::Event::CONFIG) { + const audioproc::Config* msg = &event->config(); + EXPECT_TRUE(msg->has_experiments_description()); + EXPECT_EQ(0u, msg->experiments_description().size()); + } + } +} + TEST_F(DebugDumpTest, ToggleAecLevel) { Config config; DebugDumpGenerator generator(config); diff --git a/webrtc/modules/audio_processing/test/unpack.cc b/webrtc/modules/audio_processing/test/unpack.cc index ec2317867d..fbb8e85fee 100644 --- a/webrtc/modules/audio_processing/test/unpack.cc +++ b/webrtc/modules/audio_processing/test/unpack.cc @@ -252,6 +252,10 @@ int do_main(int argc, char* argv[]) { PRINT_CONFIG(ns_enabled); PRINT_CONFIG(ns_level); PRINT_CONFIG(transient_suppression_enabled); + if (msg.has_experiments_description()) { + fprintf(settings_file, " experiments_description: %s\n", + msg.experiments_description().c_str()); + } } else if (event_msg.type() == Event::INIT) { if (!event_msg.has_init()) { printf("Corrupt input file: Init missing.\n");