From 130fef89dda535f07b5d298ba293e51ed8c057f2 Mon Sep 17 00:00:00 2001 From: "henrik.lundin@webrtc.org" Date: Mon, 8 Dec 2014 21:07:59 +0000 Subject: [PATCH] Bugfix in AudioDecoderTest When the encoded frame size (L ms) was larger than 10 ms, the test would repeat the first 10 ms L/10 times for each encoded frame. This is now fixed. BUG=3926 R=kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/35399004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7833 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../audio_coding/neteq/audio_decoder_unittest.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc b/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc index 2e8118df4..5d3713968 100644 --- a/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc +++ b/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc @@ -140,15 +140,19 @@ class AudioDecoderTest : public ::testing::Test { size_t input_len_samples, uint8_t* output) { size_t enc_len_bytes = 0; + const size_t samples_per_10ms = audio_encoder_->sample_rate_hz() / 100; + CHECK_EQ(samples_per_10ms * audio_encoder_->Num10MsFramesInNextPacket(), + input_len_samples); scoped_ptr interleaved_input( - new int16_t[channels_ * input_len_samples]); + new int16_t[channels_ * samples_per_10ms]); for (int i = 0; i < audio_encoder_->Num10MsFramesInNextPacket(); ++i) { EXPECT_EQ(0u, enc_len_bytes); // Duplicate the mono input signal to however many channels the test // wants. - test::InputAudioFile::DuplicateInterleaved( - input, input_len_samples, channels_, interleaved_input.get()); + test::InputAudioFile::DuplicateInterleaved(input + i * samples_per_10ms, + samples_per_10ms, channels_, + interleaved_input.get()); EXPECT_TRUE(audio_encoder_->Encode( 0, interleaved_input.get(), audio_encoder_->sample_rate_hz() / 100,