diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc index 0063608acd..92e63f19b8 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.cc +++ b/webrtc/modules/audio_processing/audio_processing_impl.cc @@ -498,11 +498,9 @@ int AudioProcessingImpl::ProcessStream(const float* const* src, capture_audio_->CopyFrom(src, samples_per_channel, input_layout); RETURN_ON_ERR(ProcessStreamLocked()); - if (output_copy_needed(is_data_processed())) { - capture_audio_->CopyTo(fwd_out_format_.samples_per_channel(), - output_layout, - dest); - } + capture_audio_->CopyTo(fwd_out_format_.samples_per_channel(), + output_layout, + dest); #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP if (debug_file_->Open()) { diff --git a/webrtc/modules/audio_processing/test/audio_processing_unittest.cc b/webrtc/modules/audio_processing/test/audio_processing_unittest.cc index 53c0a320c3..217ffaef0a 100644 --- a/webrtc/modules/audio_processing/test/audio_processing_unittest.cc +++ b/webrtc/modules/audio_processing/test/audio_processing_unittest.cc @@ -1344,6 +1344,28 @@ TEST_F(ApmTest, NoProcessingWhenAllComponentsDisabled) { } } +TEST_F(ApmTest, NoProcessingWhenAllComponentsDisabledFloat) { + // Test that ProcessStream copies input to output even with no processing. + const size_t kSamples = 80; + const int sample_rate = 8000; + const float src[kSamples] = { + -1.0f, 0.0f, 1.0f + }; + float dest[kSamples] = {}; + + auto src_channels = &src[0]; + auto dest_channels = &dest[0]; + + apm_.reset(AudioProcessing::Create()); + EXPECT_NOERR(apm_->ProcessStream( + &src_channels, kSamples, sample_rate, LayoutFromChannels(1), + sample_rate, LayoutFromChannels(1), &dest_channels)); + + for (size_t i = 0; i < kSamples; ++i) { + EXPECT_EQ(src[i], dest[i]); + } +} + TEST_F(ApmTest, IdenticalInputChannelsResultInIdenticalOutputChannels) { EnableAllComponents();