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

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

Issue 1484343003: NetEq: Add codec name and RTP timestamp rate to DecoderInfo (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 5 years 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 ASSERT_TRUE(neteq_); 297 ASSERT_TRUE(neteq_);
298 LoadDecoders(); 298 LoadDecoders();
299 } 299 }
300 300
301 void NetEqDecodingTest::TearDown() { 301 void NetEqDecodingTest::TearDown() {
302 delete neteq_; 302 delete neteq_;
303 } 303 }
304 304
305 void NetEqDecodingTest::LoadDecoders() { 305 void NetEqDecodingTest::LoadDecoders() {
306 // Load PCMu. 306 // Load PCMu.
307 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCMu, 0)); 307 ASSERT_EQ(0,
308 neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCMu, "pcmu", 0));
308 // Load PCMa. 309 // Load PCMa.
309 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCMa, 8)); 310 ASSERT_EQ(0,
311 neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCMa, "pcma", 8));
310 #ifdef WEBRTC_CODEC_ILBC 312 #ifdef WEBRTC_CODEC_ILBC
311 // Load iLBC. 313 // Load iLBC.
312 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderILBC, 102)); 314 ASSERT_EQ(
315 0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderILBC, "ilbc", 102));
313 #endif 316 #endif
314 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) 317 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
315 // Load iSAC. 318 // Load iSAC.
316 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderISAC, 103)); 319 ASSERT_EQ(
320 0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderISAC, "isac", 103));
317 #endif 321 #endif
318 #ifdef WEBRTC_CODEC_ISAC 322 #ifdef WEBRTC_CODEC_ISAC
319 // Load iSAC SWB. 323 // Load iSAC SWB.
320 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderISACswb, 104)); 324 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderISACswb,
325 "isac-swb", 104));
321 #endif 326 #endif
322 // Load PCM16B nb. 327 // Load PCM16B nb.
323 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16B, 93)); 328 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16B,
329 "pcm16-nb", 93));
324 // Load PCM16B wb. 330 // Load PCM16B wb.
325 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16Bwb, 94)); 331 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16Bwb,
332 "pcm16-wb", 94));
326 // Load PCM16B swb32. 333 // Load PCM16B swb32.
327 ASSERT_EQ( 334 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16Bswb32kHz,
328 0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16Bswb32kHz, 95)); 335 "pcm16-swb32", 95));
329 // Load CNG 8 kHz. 336 // Load CNG 8 kHz.
330 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGnb, 13)); 337 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGnb,
338 "cng-nb", 13));
331 // Load CNG 16 kHz. 339 // Load CNG 16 kHz.
332 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGwb, 98)); 340 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGwb,
341 "cng-wb", 98));
333 } 342 }
334 343
335 void NetEqDecodingTest::OpenInputFile(const std::string &rtp_file) { 344 void NetEqDecodingTest::OpenInputFile(const std::string &rtp_file) {
336 rtp_source_.reset(test::RtpFileSource::Create(rtp_file)); 345 rtp_source_.reset(test::RtpFileSource::Create(rtp_file));
337 } 346 }
338 347
339 void NetEqDecodingTest::Process(size_t* out_len) { 348 void NetEqDecodingTest::Process(size_t* out_len) {
340 // Check if time to receive. 349 // Check if time to receive.
341 while (packet_ && sim_clock_ >= packet_->time_ms()) { 350 while (packet_ && sim_clock_ >= packet_->time_ms()) {
342 if (packet_->payload_length_bytes() > 0) { 351 if (packet_->payload_length_bytes() > 0) {
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 uint8_t kCngNbPayloadType = 2; 1089 uint8_t kCngNbPayloadType = 2;
1081 uint8_t kCngWbPayloadType = 3; 1090 uint8_t kCngWbPayloadType = 3;
1082 uint8_t kCngSwb32PayloadType = 4; 1091 uint8_t kCngSwb32PayloadType = 4;
1083 uint8_t kCngSwb48PayloadType = 5; 1092 uint8_t kCngSwb48PayloadType = 5;
1084 uint8_t kAvtPayloadType = 6; 1093 uint8_t kAvtPayloadType = 6;
1085 uint8_t kRedPayloadType = 7; 1094 uint8_t kRedPayloadType = 7;
1086 uint8_t kIsacPayloadType = 9; // Payload type 8 is already registered. 1095 uint8_t kIsacPayloadType = 9; // Payload type 8 is already registered.
1087 1096
1088 // Register decoders. 1097 // Register decoders.
1089 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16Bwb, 1098 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16Bwb,
1090 kPcm16WbPayloadType)); 1099 "pcm16-wb", kPcm16WbPayloadType));
1091 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGnb, 1100 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGnb,
1092 kCngNbPayloadType)); 1101 "cng-nb", kCngNbPayloadType));
1093 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGwb, 1102 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGwb,
1094 kCngWbPayloadType)); 1103 "cng-wb", kCngWbPayloadType));
1095 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGswb32kHz, 1104 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGswb32kHz,
1096 kCngSwb32PayloadType)); 1105 "cng-swb32", kCngSwb32PayloadType));
1097 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGswb48kHz, 1106 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGswb48kHz,
1098 kCngSwb48PayloadType)); 1107 "cng-swb48", kCngSwb48PayloadType));
1099 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderAVT, 1108 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderAVT, "avt",
1100 kAvtPayloadType)); 1109 kAvtPayloadType));
1101 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderRED, 1110 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderRED, "red",
1102 kRedPayloadType)); 1111 kRedPayloadType));
1103 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderISAC, 1112 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderISAC, "isac",
1104 kIsacPayloadType)); 1113 kIsacPayloadType));
1105 1114
1106 PopulateRtpInfo(0, 0, &rtp_info); 1115 PopulateRtpInfo(0, 0, &rtp_info);
1107 rtp_info.header.payloadType = kPcm16WbPayloadType; 1116 rtp_info.header.payloadType = kPcm16WbPayloadType;
1108 1117
1109 // The first packet injected cannot be sync-packet. 1118 // The first packet injected cannot be sync-packet.
1110 EXPECT_EQ(-1, neteq_->InsertSyncPacket(rtp_info, receive_timestamp)); 1119 EXPECT_EQ(-1, neteq_->InsertSyncPacket(rtp_info, receive_timestamp));
1111 1120
1112 // Payload length of 10 ms PCM16 16 kHz. 1121 // Payload length of 10 ms PCM16 16 kHz.
1113 const size_t kPayloadBytes = kBlockSize16kHz * sizeof(int16_t); 1122 const size_t kPayloadBytes = kBlockSize16kHz * sizeof(int16_t);
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 // Pull audio once. 1546 // Pull audio once.
1538 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len, 1547 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len,
1539 &num_channels, &type)); 1548 &num_channels, &type));
1540 ASSERT_EQ(kBlockSize16kHz, out_len); 1549 ASSERT_EQ(kBlockSize16kHz, out_len);
1541 } 1550 }
1542 // Verify speech output. 1551 // Verify speech output.
1543 EXPECT_EQ(kOutputNormal, type); 1552 EXPECT_EQ(kOutputNormal, type);
1544 } 1553 }
1545 1554
1546 } // namespace webrtc 1555 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698