Chromium Code Reviews| Index: webrtc/modules/audio_processing/residual_echo_detector_complexity_unittest.cc |
| diff --git a/webrtc/modules/audio_processing/residual_echo_detector_complexity_unittest.cc b/webrtc/modules/audio_processing/residual_echo_detector_complexity_unittest.cc |
| index 8f1f8543632486d2953134fdfa3ce8e0828185fd..b9208428ad04ea88d43616a12929bd51799f170a 100644 |
| --- a/webrtc/modules/audio_processing/residual_echo_detector_complexity_unittest.cc |
| +++ b/webrtc/modules/audio_processing/residual_echo_detector_complexity_unittest.cc |
| @@ -26,7 +26,7 @@ |
| namespace webrtc { |
| namespace { |
| -const size_t kNumFramesToProcess = 100; |
| +const size_t kNumFramesToProcess = 500; |
| const int kSampleRate = AudioProcessing::kSampleRate48kHz; |
| const int kNumberOfChannels = 1; |
| @@ -47,16 +47,24 @@ void RunStandaloneSubmodule() { |
| echo_detector.Initialize(); |
| for (size_t frame_no = 0; frame_no < kNumFramesToProcess; ++frame_no) { |
| - buffers.UpdateInputBuffers(); |
| + // The first 20 frames are for warming up, and are not part of the |
| + // benchmark. After that the processing time is measured in chunks of 20 |
| + // frames. |
| + if (frame_no >= 20 && frame_no % 20 == 0) { |
|
peah-webrtc
2016/12/14 09:00:04
You should probably add a constant (or 2) for the
ivoc
2016/12/14 09:46:42
Good idea, done.
|
| + timer.StartTimer(); |
| + } |
| - timer.StartTimer(); |
| + buffers.UpdateInputBuffers(); |
| echo_detector.AnalyzeRenderAudio(rtc::ArrayView<const float>( |
| buffers.render_input_buffer->split_bands_const_f(0)[kBand0To8kHz], |
| buffers.render_input_buffer->num_frames_per_band())); |
| echo_detector.AnalyzeCaptureAudio(rtc::ArrayView<const float>( |
| buffers.capture_input_buffer->split_bands_const_f(0)[kBand0To8kHz], |
| buffers.capture_input_buffer->num_frames_per_band())); |
| - timer.StopTimer(); |
| + |
| + if (frame_no >= 20 && frame_no % 20 == 19) { |
|
peah-webrtc
2016/12/14 09:00:04
Please add a constant (or 2) for the 20s.
ivoc
2016/12/14 09:46:42
Done.
|
| + timer.StopTimer(); |
| + } |
| } |
| webrtc::test::PrintResultMeanAndError( |
| "echo_detector_call_durations", "", "StandaloneEchoDetector", |
| @@ -69,9 +77,7 @@ void RunTogetherWithApm(std::string test_description, |
| test::SimulatorBuffers buffers( |
| kSampleRate, kSampleRate, kSampleRate, kSampleRate, kNumberOfChannels, |
| kNumberOfChannels, kNumberOfChannels, kNumberOfChannels); |
| - test::PerformanceTimer render_timer(kNumFramesToProcess); |
| - test::PerformanceTimer capture_timer(kNumFramesToProcess); |
| - test::PerformanceTimer total_timer(kNumFramesToProcess); |
| + test::PerformanceTimer timer(kNumFramesToProcess); |
| webrtc::Config config; |
| AudioProcessing::Config apm_config; |
| @@ -112,18 +118,20 @@ void RunTogetherWithApm(std::string test_description, |
| StreamConfig stream_config(kSampleRate, kNumberOfChannels, false); |
| for (size_t frame_no = 0; frame_no < kNumFramesToProcess; ++frame_no) { |
| + // The first 20 frames are for warming up, and are not part of the |
| + // benchmark. After that the processing time is measured in chunks of 20 |
| + // frames. |
| + if (frame_no >= 20 && frame_no % 20 == 0) { |
|
peah-webrtc
2016/12/14 09:00:04
Please add a constant (or 2) for the 20s.
ivoc
2016/12/14 09:46:42
Done.
|
| + timer.StartTimer(); |
| + } |
| + |
| buffers.UpdateInputBuffers(); |
| - total_timer.StartTimer(); |
| - render_timer.StartTimer(); |
| ASSERT_EQ( |
| AudioProcessing::kNoError, |
| apm->ProcessReverseStream(&buffers.render_input[0], stream_config, |
| stream_config, &buffers.render_output[0])); |
| - render_timer.StopTimer(); |
| - |
| - capture_timer.StartTimer(); |
| ASSERT_EQ(AudioProcessing::kNoError, apm->set_stream_delay_ms(0)); |
| if (include_default_apm_processing) { |
| apm->gain_control()->set_stream_analog_level(0); |
| @@ -135,19 +143,14 @@ void RunTogetherWithApm(std::string test_description, |
| apm->ProcessStream(&buffers.capture_input[0], stream_config, |
| stream_config, &buffers.capture_output[0])); |
| - capture_timer.StopTimer(); |
| - total_timer.StopTimer(); |
| + if (frame_no >= 20 && frame_no % 20 == 19) { |
|
peah-webrtc
2016/12/14 09:00:04
Please add a constant (or 2) for the 20s.
ivoc
2016/12/14 09:46:42
Done.
|
| + timer.StopTimer(); |
| + } |
| } |
| webrtc::test::PrintResultMeanAndError( |
| - "echo_detector_call_durations", "_render", test_description, |
| - FormPerformanceMeasureString(render_timer), "us", false); |
| - webrtc::test::PrintResultMeanAndError( |
| - "echo_detector_call_durations", "_capture", test_description, |
| - FormPerformanceMeasureString(capture_timer), "us", false); |
| - webrtc::test::PrintResultMeanAndError( |
| "echo_detector_call_durations", "_total", test_description, |
| - FormPerformanceMeasureString(total_timer), "us", false); |
| + FormPerformanceMeasureString(timer), "us", false); |
| } |
| } // namespace |