From d72595eeea4812f33bc7e23ec4c2bfcc99adac2f Mon Sep 17 00:00:00 2001 From: "henrik.lundin" Date: Thu, 10 Mar 2016 02:26:29 -0800 Subject: [PATCH] Fix NetEq performance test regression The test code created an AudioBuffer object inside the work loop. This turned out to be expensive, since the AudioBuffer ctor implicitly called memset on all of the audio data array. The obvious remedy is to create the buffer outside of the loop. This does not have any impact apart from the performance boost, since the output data from NetEq is not even considered in the test. BUG=chromium:592907,webrtc:5647 TBR=ivoc@webrtc.org NOTRY=true Review URL: https://codereview.webrtc.org/1782803002 Cr-Commit-Position: refs/heads/master@{#11940} --- .../modules/audio_coding/neteq/tools/neteq_performance_test.cc | 2 +- webrtc/modules/include/module_common_types.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc index 32c085d3e0..59402a2029 100644 --- a/webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc +++ b/webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc @@ -75,6 +75,7 @@ int64_t NetEqPerformanceTest::Run(int runtime_ms, // Main loop. webrtc::Clock* clock = webrtc::Clock::GetRealTimeClock(); int64_t start_time_ms = clock->TimeInMilliseconds(); + AudioFrame out_frame; while (time_now_ms < runtime_ms) { while (packet_input_time_ms <= time_now_ms) { // Drop every N packets, where N = FLAGS_lossrate. @@ -104,7 +105,6 @@ int64_t NetEqPerformanceTest::Run(int runtime_ms, } // Get output audio, but don't do anything with it. - AudioFrame out_frame; int error = neteq->GetAudio(&out_frame); if (error != NetEq::kOK) return -1; diff --git a/webrtc/modules/include/module_common_types.h b/webrtc/modules/include/module_common_types.h index 706eea3685..6074eec793 100644 --- a/webrtc/modules/include/module_common_types.h +++ b/webrtc/modules/include/module_common_types.h @@ -541,6 +541,8 @@ class AudioFrame { RTC_DISALLOW_COPY_AND_ASSIGN(AudioFrame); }; +// TODO(henrik.lundin) Can we remove the call to data_()? +// See https://bugs.chromium.org/p/webrtc/issues/detail?id=5647. inline AudioFrame::AudioFrame() : data_() { Reset();