Merge the preambles of the ProcessStream implementations

The two functions have a lot of shared logic and locking. This CL consolidates that into a single function.

Bug: webrtc:111235
Change-Id: Ib1c32165dbf0e212c7d4b0753bcbb5ffd05eb6fe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/163022
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30144}
This commit is contained in:
Sam Zackrisson
2020-01-03 14:54:20 +01:00
committed by Commit Bot
parent 0f14db22de
commit 12e319aafe
4 changed files with 51 additions and 93 deletions

View File

@ -378,6 +378,15 @@ TEST(AudioProcessingImplTest, RenderPreProcessorBeforeEchoDetector) {
constexpr int16_t kAudioLevel = 1000;
constexpr int kSampleRateHz = 16000;
constexpr size_t kNumChannels = 1;
// Explicitly initialize APM to ensure no render frames are discarded.
const ProcessingConfig processing_config = {{
{kSampleRateHz, kNumChannels, /*has_keyboard=*/false},
{kSampleRateHz, kNumChannels, /*has_keyboard=*/false},
{kSampleRateHz, kNumChannels, /*has_keyboard=*/false},
{kSampleRateHz, kNumChannels, /*has_keyboard=*/false},
}};
apm->Initialize(processing_config);
AudioFrame frame;
InitializeAudioFrame(kSampleRateHz, kNumChannels, &frame);