Index: webrtc/modules/audio_coding/neteq/sync_buffer_unittest.cc |
diff --git a/webrtc/modules/audio_coding/neteq/sync_buffer_unittest.cc b/webrtc/modules/audio_coding/neteq/sync_buffer_unittest.cc |
index 332ec2f4e8da4f199a822c8579168f410b4c8a19..0f7b98978d3724f0329ca8cb56253b1a36952569 100644 |
--- a/webrtc/modules/audio_coding/neteq/sync_buffer_unittest.cc |
+++ b/webrtc/modules/audio_coding/neteq/sync_buffer_unittest.cc |
@@ -140,20 +140,29 @@ TEST(SyncBuffer, GetNextAudioInterleaved) { |
// Read to interleaved output. Read in two batches, where each read operation |
// should automatically update the |net_index_| in the SyncBuffer. |
- int16_t output[kChannels * kNewLen]; |
// Note that |samples_read| is the number of samples read from each channel. |
// That is, the number of samples written to |output| is |
// |samples_read| * |kChannels|. |
- size_t samples_read = sync_buffer.GetNextAudioInterleaved(kNewLen / 2, |
- output); |
- samples_read += |
- sync_buffer.GetNextAudioInterleaved(kNewLen / 2, |
- &output[samples_read * kChannels]); |
- EXPECT_EQ(kNewLen, samples_read); |
+ AudioFrame output1; |
+ sync_buffer.GetNextAudioInterleaved(kNewLen / 2, &output1); |
+ EXPECT_EQ(kChannels, output1.num_channels_); |
+ EXPECT_EQ(kNewLen / 2, output1.samples_per_channel_); |
+ |
+ AudioFrame output2; |
+ sync_buffer.GetNextAudioInterleaved(kNewLen / 2, &output2); |
+ EXPECT_EQ(kChannels, output2.num_channels_); |
+ EXPECT_EQ(kNewLen / 2, output2.samples_per_channel_); |
// Verify the data. |
- int16_t* output_ptr = output; |
- for (size_t i = 0; i < kNewLen; ++i) { |
+ int16_t* output_ptr = output1.data_; |
+ for (size_t i = 0; i < kNewLen / 2; ++i) { |
+ for (size_t channel = 0; channel < kChannels; ++channel) { |
+ EXPECT_EQ(new_data[channel][i], *output_ptr); |
+ ++output_ptr; |
+ } |
+ } |
+ output_ptr = output2.data_; |
+ for (size_t i = kNewLen / 2; i < kNewLen; ++i) { |
for (size_t channel = 0; channel < kChannels; ++channel) { |
EXPECT_EQ(new_data[channel][i], *output_ptr); |
++output_ptr; |