Avoid render resampling when there is no need for render signal analysis.

This CL adjusts the render processing rate such to avoid resampling of the
render signal when that is not needed.
Note that to avoid acquiring more locks than needed, this should be achieved
during initialization.

BUG=webrtc:7667

Review-Url: https://codereview.webrtc.org/2887693002
Cr-Commit-Position: refs/heads/master@{#18207}
This commit is contained in:
peah
2017-05-19 01:28:05 -07:00
committed by Commit bot
parent 7f52f08421
commit ce4d91527a
2 changed files with 12 additions and 4 deletions

View File

@ -471,6 +471,7 @@ int AudioProcessingImpl::InitializeLocked() {
render_.render_audio.reset(nullptr);
render_.render_converter.reset(nullptr);
}
capture_.capture_audio.reset(
new AudioBuffer(formats_.api_format.input_stream().num_frames(),
formats_.api_format.input_stream().num_channels(),
@ -596,7 +597,13 @@ int AudioProcessingImpl::InitializeLocked(const ProcessingConfig& config) {
// Always downmix the render stream to mono for analysis. This has been
// demonstrated to work well for AEC in most practical scenarios.
formats_.render_processing_format = StreamConfig(render_processing_rate, 1);
if (submodule_states_.RenderMultiBandSubModulesActive()) {
formats_.render_processing_format = StreamConfig(render_processing_rate, 1);
} else {
formats_.render_processing_format = StreamConfig(
formats_.api_format.reverse_input_stream().sample_rate_hz(),
formats_.api_format.reverse_input_stream().num_channels());
}
if (capture_nonlocked_.capture_processing_format.sample_rate_hz() ==
kSampleRate32kHz ||
@ -1460,7 +1467,10 @@ int AudioProcessingImpl::ProcessRenderStreamLocked() {
}
#endif
QueueBandedRenderAudio(render_buffer);
if (submodule_states_.RenderMultiBandSubModulesActive()) {
QueueBandedRenderAudio(render_buffer);
}
// TODO(peah): Perform the queueing ínside QueueRenderAudiuo().
if (private_submodules_->echo_canceller3) {
private_submodules_->echo_canceller3->AnalyzeRender(render_buffer);

View File

@ -862,8 +862,6 @@ TEST_F(ApmTest, ChannelsInt16Interface) {
for (size_t i = 1; i < 4; i++) {
TestChangingChannelsInt16Interface(i, kNoErr);
EXPECT_EQ(i, apm_->num_input_channels());
// We always force the number of reverse channels used for processing to 1.
EXPECT_EQ(1u, apm_->num_reverse_channels());
}
}