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

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

Issue 1424083002: Make an enum class out of NetEqDecoder, and hide the neteq_decoders_ table (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 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(kDecoderPCMu, 0)); 307 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCMu, 0));
308 // Load PCMa. 308 // Load PCMa.
309 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCMa, 8)); 309 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCMa, 8));
310 #ifdef WEBRTC_CODEC_ILBC 310 #ifdef WEBRTC_CODEC_ILBC
311 // Load iLBC. 311 // Load iLBC.
312 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderILBC, 102)); 312 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderILBC, 102));
313 #endif 313 #endif
314 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) 314 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
315 // Load iSAC. 315 // Load iSAC.
316 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderISAC, 103)); 316 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderISAC, 103));
317 #endif 317 #endif
318 #ifdef WEBRTC_CODEC_ISAC 318 #ifdef WEBRTC_CODEC_ISAC
319 // Load iSAC SWB. 319 // Load iSAC SWB.
320 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderISACswb, 104)); 320 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderISACswb, 104));
321 #endif 321 #endif
322 // Load PCM16B nb. 322 // Load PCM16B nb.
323 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCM16B, 93)); 323 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16B, 93));
324 // Load PCM16B wb. 324 // Load PCM16B wb.
325 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCM16Bwb, 94)); 325 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16Bwb, 94));
326 // Load PCM16B swb32. 326 // Load PCM16B swb32.
327 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCM16Bswb32kHz, 95)); 327 ASSERT_EQ(
328 0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16Bswb32kHz, 95));
328 // Load CNG 8 kHz. 329 // Load CNG 8 kHz.
329 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderCNGnb, 13)); 330 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGnb, 13));
330 // Load CNG 16 kHz. 331 // Load CNG 16 kHz.
331 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderCNGwb, 98)); 332 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGwb, 98));
332 } 333 }
333 334
334 void NetEqDecodingTest::OpenInputFile(const std::string &rtp_file) { 335 void NetEqDecodingTest::OpenInputFile(const std::string &rtp_file) {
335 rtp_source_.reset(test::RtpFileSource::Create(rtp_file)); 336 rtp_source_.reset(test::RtpFileSource::Create(rtp_file));
336 } 337 }
337 338
338 void NetEqDecodingTest::Process(size_t* out_len) { 339 void NetEqDecodingTest::Process(size_t* out_len) {
339 // Check if time to receive. 340 // Check if time to receive.
340 while (packet_ && sim_clock_ >= packet_->time_ms()) { 341 while (packet_ && sim_clock_ >= packet_->time_ms()) {
341 if (packet_->payload_length_bytes() > 0) { 342 if (packet_->payload_length_bytes() > 0) {
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 uint8_t kPcm16WbPayloadType = 1; 1073 uint8_t kPcm16WbPayloadType = 1;
1073 uint8_t kCngNbPayloadType = 2; 1074 uint8_t kCngNbPayloadType = 2;
1074 uint8_t kCngWbPayloadType = 3; 1075 uint8_t kCngWbPayloadType = 3;
1075 uint8_t kCngSwb32PayloadType = 4; 1076 uint8_t kCngSwb32PayloadType = 4;
1076 uint8_t kCngSwb48PayloadType = 5; 1077 uint8_t kCngSwb48PayloadType = 5;
1077 uint8_t kAvtPayloadType = 6; 1078 uint8_t kAvtPayloadType = 6;
1078 uint8_t kRedPayloadType = 7; 1079 uint8_t kRedPayloadType = 7;
1079 uint8_t kIsacPayloadType = 9; // Payload type 8 is already registered. 1080 uint8_t kIsacPayloadType = 9; // Payload type 8 is already registered.
1080 1081
1081 // Register decoders. 1082 // Register decoders.
1082 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCM16Bwb, 1083 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderPCM16Bwb,
1083 kPcm16WbPayloadType)); 1084 kPcm16WbPayloadType));
1084 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderCNGnb, kCngNbPayloadType)); 1085 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGnb,
1085 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderCNGwb, kCngWbPayloadType)); 1086 kCngNbPayloadType));
1086 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderCNGswb32kHz, 1087 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGwb,
1088 kCngWbPayloadType));
1089 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGswb32kHz,
1087 kCngSwb32PayloadType)); 1090 kCngSwb32PayloadType));
1088 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderCNGswb48kHz, 1091 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderCNGswb48kHz,
1089 kCngSwb48PayloadType)); 1092 kCngSwb48PayloadType));
1090 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderAVT, kAvtPayloadType)); 1093 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderAVT,
1091 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderRED, kRedPayloadType)); 1094 kAvtPayloadType));
1092 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderISAC, kIsacPayloadType)); 1095 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderRED,
1096 kRedPayloadType));
1097 ASSERT_EQ(0, neteq_->RegisterPayloadType(NetEqDecoder::kDecoderISAC,
1098 kIsacPayloadType));
1093 1099
1094 PopulateRtpInfo(0, 0, &rtp_info); 1100 PopulateRtpInfo(0, 0, &rtp_info);
1095 rtp_info.header.payloadType = kPcm16WbPayloadType; 1101 rtp_info.header.payloadType = kPcm16WbPayloadType;
1096 1102
1097 // The first packet injected cannot be sync-packet. 1103 // The first packet injected cannot be sync-packet.
1098 EXPECT_EQ(-1, neteq_->InsertSyncPacket(rtp_info, receive_timestamp)); 1104 EXPECT_EQ(-1, neteq_->InsertSyncPacket(rtp_info, receive_timestamp));
1099 1105
1100 // Payload length of 10 ms PCM16 16 kHz. 1106 // Payload length of 10 ms PCM16 16 kHz.
1101 const size_t kPayloadBytes = kBlockSize16kHz * sizeof(int16_t); 1107 const size_t kPayloadBytes = kBlockSize16kHz * sizeof(int16_t);
1102 uint8_t payload[kPayloadBytes] = {0}; 1108 uint8_t payload[kPayloadBytes] = {0};
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 // Pull audio once. 1531 // Pull audio once.
1526 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len, 1532 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len,
1527 &num_channels, &type)); 1533 &num_channels, &type));
1528 ASSERT_EQ(kBlockSize16kHz, out_len); 1534 ASSERT_EQ(kBlockSize16kHz, out_len);
1529 } 1535 }
1530 // Verify speech output. 1536 // Verify speech output.
1531 EXPECT_EQ(kOutputNormal, type); 1537 EXPECT_EQ(kOutputNormal, type);
1532 } 1538 }
1533 1539
1534 } // namespace webrtc 1540 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_stereo_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/payload_splitter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698