Add DCHECK and documentation to disallow trying to read more than two audio channels in helper function.

Bug: webrtc:8741
Change-Id: Ib55b15bb1802b412be17ef8199d6112937502cd3
Reviewed-on: https://webrtc-review.googlesource.com/39263
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21603}
This commit is contained in:
Sam Zackrisson 2018-01-12 13:47:53 +01:00 committed by Commit Bot
parent f707186185
commit 4030c65c30
2 changed files with 2 additions and 1 deletions

View file

@ -57,6 +57,7 @@ void ReadFloatSamplesFromStereoFile(size_t samples_per_channel,
size_t num_channels,
InputAudioFile* stereo_pcm_file,
rtc::ArrayView<float> data) {
RTC_DCHECK_LE(num_channels, 2);
RTC_DCHECK_EQ(data.size(), samples_per_channel * num_channels);
std::vector<int16_t> read_samples(samples_per_channel * 2);
stereo_pcm_file->Read(samples_per_channel * 2, read_samples.data());

View file

@ -29,7 +29,7 @@ std::string GetApmRenderTestVectorFileName(int sample_rate_hz);
// APM bitexactness test.
std::string GetApmCaptureTestVectorFileName(int sample_rate_hz);
// Extract float samples from a pcm file.
// Extract float samples of up to two channels from a pcm file.
void ReadFloatSamplesFromStereoFile(size_t samples_per_channel,
size_t num_channels,
InputAudioFile* stereo_pcm_file,