From fea8b94591c300a6dec886cc5f9c9eaf00b8a1db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85hgren?= Date: Tue, 7 Apr 2020 11:33:16 +0200 Subject: [PATCH] Reland "APM: Remove the usage of AudioFrame in the AudioProcessing interface" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a reland of 12e2d4ddb235da6ec7a5c1c3a83ac33d394920b0 Original change's description: > APM: Remove the usage of AudioFrame in the AudioProcessing interface > > This CL removes the AudioFrame-based APIs from the AudioProcessing > interface. > > Bug: webrtc:5298 > Change-Id: Iab470b26b10e06dcf29c543851ae0085bc5b66f0 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172939 > Reviewed-by: Sam Zackrisson > Commit-Queue: Per Åhgren > Cr-Commit-Position: refs/heads/master@{#31016} Bug: webrtc:5298 Change-Id: I70e6d59afc3716ee6109d8b9dc384abc71c93624 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173476 Reviewed-by: Sam Zackrisson Commit-Queue: Per Åhgren Cr-Commit-Position: refs/heads/master@{#31066} --- .../audio_processing/audio_processing_impl.h | 7 ----- .../include/audio_processing.h | 27 ------------------- .../include/mock_audio_processing.h | 2 -- test/fuzzers/BUILD.gn | 1 + .../fuzzers/audio_processing_fuzzer_helper.cc | 5 ++-- 5 files changed, 4 insertions(+), 38 deletions(-) diff --git a/modules/audio_processing/audio_processing_impl.h b/modules/audio_processing/audio_processing_impl.h index 28a8829a4d..258e2e1424 100644 --- a/modules/audio_processing/audio_processing_impl.h +++ b/modules/audio_processing/audio_processing_impl.h @@ -44,7 +44,6 @@ namespace webrtc { class ApmDataDumper; -class AudioFrame; class AudioConverter; class AudioProcessingImpl : public AudioProcessing { @@ -81,9 +80,6 @@ class AudioProcessingImpl : public AudioProcessing { // Capture-side exclusive methods possibly running APM in a // multi-threaded manner. Acquire the capture lock. - int ProcessStream(AudioFrame* frame) override { - return ProcessAudioFrame(this, frame); - } int ProcessStream(const int16_t* const src, const StreamConfig& input_config, const StreamConfig& output_config, @@ -102,9 +98,6 @@ class AudioProcessingImpl : public AudioProcessing { // Render-side exclusive methods possibly running APM in a // multi-threaded manner. Acquire the render lock. - int ProcessReverseStream(AudioFrame* frame) override { - return ProcessReverseAudioFrame(this, frame); - } int ProcessReverseStream(const int16_t* const src, const StreamConfig& input_config, const StreamConfig& output_config, diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h index 953ccebaba..265507dd66 100644 --- a/modules/audio_processing/include/audio_processing.h +++ b/modules/audio_processing/include/audio_processing.h @@ -39,7 +39,6 @@ namespace webrtc { class AecDump; class AudioBuffer; -class AudioFrame; class StreamConfig; class ProcessingConfig; @@ -523,18 +522,6 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface { // Enqueue a runtime setting. virtual void SetRuntimeSetting(RuntimeSetting setting) = 0; - // Processes a 10 ms |frame| of the primary audio stream. On the client-side, - // this is the near-end (or captured) audio. - // - // If needed for enabled functionality, any function with the set_stream_ tag - // must be called prior to processing the current frame. Any getter function - // with the stream_ tag which is needed should be called after processing. - // - // The |sample_rate_hz_|, |num_channels_|, and |samples_per_channel_| - // members of |frame| must be valid. If changed from the previous call to this - // method, it will trigger an initialization. - virtual int ProcessStream(AudioFrame* frame) = 0; - // Accepts and produces a 10 ms frame interleaved 16 bit integer audio as // specified in |input_config| and |output_config|. |src| and |dest| may use // the same memory, if desired. @@ -555,20 +542,6 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface { const StreamConfig& output_config, float* const* dest) = 0; - // Processes a 10 ms |frame| of the reverse direction audio stream. The frame - // may be modified. On the client-side, this is the far-end (or to be - // rendered) audio. - // - // It is necessary to provide this if echo processing is enabled, as the - // reverse stream forms the echo reference signal. It is recommended, but not - // necessary, to provide if gain control is enabled. On the server-side this - // typically will not be used. If you're not sure what to pass in here, - // chances are you don't need to use it. - // - // The |sample_rate_hz_|, |num_channels_|, and |samples_per_channel_| - // members of |frame| must be valid. - virtual int ProcessReverseStream(AudioFrame* frame) = 0; - // Accepts and produces a 10 ms frame of interleaved 16 bit integer audio for // the reverse direction audio stream as specified in |input_config| and // |output_config|. |src| and |dest| may use the same memory, if desired. diff --git a/modules/audio_processing/include/mock_audio_processing.h b/modules/audio_processing/include/mock_audio_processing.h index f3e936185f..66c5831e79 100644 --- a/modules/audio_processing/include/mock_audio_processing.h +++ b/modules/audio_processing/include/mock_audio_processing.h @@ -81,7 +81,6 @@ class MockAudioProcessing : public ::testing::NiceMock { MOCK_CONST_METHOD0(num_reverse_channels, size_t()); MOCK_METHOD1(set_output_will_be_muted, void(bool muted)); MOCK_METHOD1(SetRuntimeSetting, void(RuntimeSetting setting)); - MOCK_METHOD1(ProcessStream, int(AudioFrame* frame)); MOCK_METHOD4(ProcessStream, int(const int16_t* const src, const StreamConfig& input_config, @@ -100,7 +99,6 @@ class MockAudioProcessing : public ::testing::NiceMock { const StreamConfig& input_config, const StreamConfig& output_config, float* const* dest)); - MOCK_METHOD1(ProcessReverseStream, int(AudioFrame* frame)); MOCK_METHOD4(ProcessReverseStream, int(const int16_t* const src, const StreamConfig& input_config, diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn index 123e54840b..f52797d67f 100644 --- a/test/fuzzers/BUILD.gn +++ b/test/fuzzers/BUILD.gn @@ -436,6 +436,7 @@ rtc_library("audio_processing_fuzzer_helper") { "../../api/audio:audio_frame_api", "../../modules/audio_processing", "../../modules/audio_processing:api", + "../../modules/audio_processing:audio_frame_proxies", "../../rtc_base:checks", "../../rtc_base:rtc_base_approved", "//third_party/abseil-cpp/absl/types:optional", diff --git a/test/fuzzers/audio_processing_fuzzer_helper.cc b/test/fuzzers/audio_processing_fuzzer_helper.cc index 87b68f42e3..cb53a04cbb 100644 --- a/test/fuzzers/audio_processing_fuzzer_helper.cc +++ b/test/fuzzers/audio_processing_fuzzer_helper.cc @@ -16,6 +16,7 @@ #include #include "api/audio/audio_frame.h" +#include "modules/audio_processing/include/audio_frame_proxies.h" #include "modules/audio_processing/include/audio_processing.h" #include "rtc_base/checks.h" @@ -130,9 +131,9 @@ void FuzzAudioProcessing(test::FuzzDataHelper* fuzz_data, GenerateFixedFrame(fuzz_data, input_rate, num_channels, &fixed_frame); if (is_capture) { - apm_return_code = apm->ProcessStream(&fixed_frame); + apm_return_code = ProcessAudioFrame(apm.get(), &fixed_frame); } else { - apm_return_code = apm->ProcessReverseStream(&fixed_frame); + apm_return_code = ProcessReverseAudioFrame(apm.get(), &fixed_frame); } }