Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_unittest.cc

Issue 1418423010: Pass audio to AudioEncoder::Encode() in an ArrayView (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 uint8_t payload[kBlockSize32kHz * sizeof(int16_t)]; 932 uint8_t payload[kBlockSize32kHz * sizeof(int16_t)];
933 WebRtcRTPHeader rtp_info; 933 WebRtcRTPHeader rtp_info;
934 PopulateRtpInfo(0, 0, &rtp_info); 934 PopulateRtpInfo(0, 0, &rtp_info);
935 rtp_info.header.payloadType = payload_type; 935 rtp_info.header.payloadType = payload_type;
936 936
937 int number_channels = 0; 937 int number_channels = 0;
938 size_t samples_per_channel = 0; 938 size_t samples_per_channel = 0;
939 939
940 uint32_t receive_timestamp = 0; 940 uint32_t receive_timestamp = 0;
941 for (int n = 0; n < 10; ++n) { // Insert few packets and get audio. 941 for (int n = 0; n < 10; ++n) { // Insert few packets and get audio.
942 size_t enc_len_bytes = WebRtcPcm16b_Encode( 942 auto block = input.GetNextBlock();
943 input.GetNextBlock(), expected_samples_per_channel, payload); 943 ASSERT_EQ(expected_samples_per_channel, block.size());
944 size_t enc_len_bytes =
945 WebRtcPcm16b_Encode(block.data(), block.size(), payload);
944 ASSERT_EQ(enc_len_bytes, expected_samples_per_channel * 2); 946 ASSERT_EQ(enc_len_bytes, expected_samples_per_channel * 2);
945 947
946 number_channels = 0; 948 number_channels = 0;
947 samples_per_channel = 0; 949 samples_per_channel = 0;
948 ASSERT_EQ(0, 950 ASSERT_EQ(0,
949 neteq_->InsertPacket(rtp_info, payload, enc_len_bytes, 951 neteq_->InsertPacket(rtp_info, payload, enc_len_bytes,
950 receive_timestamp)); 952 receive_timestamp));
951 ASSERT_EQ(0, 953 ASSERT_EQ(0,
952 neteq_->GetAudio(kBlockSize32kHz, 954 neteq_->GetAudio(kBlockSize32kHz,
953 output, 955 output,
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1531 // Pull audio once. 1533 // Pull audio once.
1532 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len, 1534 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len,
1533 &num_channels, &type)); 1535 &num_channels, &type));
1534 ASSERT_EQ(kBlockSize16kHz, out_len); 1536 ASSERT_EQ(kBlockSize16kHz, out_len);
1535 } 1537 }
1536 // Verify speech output. 1538 // Verify speech output.
1537 EXPECT_EQ(kOutputNormal, type); 1539 EXPECT_EQ(kOutputNormal, type);
1538 } 1540 }
1539 1541
1540 } // namespace webrtc 1542 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698