Always copy processed audio to output buffer in ProcessStream.
In the old AudioFrame ProcessStream API, input and output buffers were shared. Now that the buffers are distinct, the input must be copied to the output even when no processing occurred. R=andrew@webrtc.org Committed: https://code.google.com/p/webrtc/source/detail?r=78de5010d167d1e375e05d26177aad43c2e2de08 Review URL: https://webrtc-codereview.appspot.com/41459004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@8052 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
c0da63c707
commit
d6e84d9d13
@ -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()) {
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user