OLD | NEW |
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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(kDecoderPCMu, 0)); |
308 // Load PCMa. | 308 // Load PCMa. |
309 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCMa, 8)); | 309 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCMa, 8)); |
310 #ifndef WEBRTC_ANDROID | 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(kDecoderILBC, 102)); |
313 #endif // WEBRTC_ANDROID | 313 #endif |
| 314 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) |
314 // Load iSAC. | 315 // Load iSAC. |
315 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderISAC, 103)); | 316 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderISAC, 103)); |
316 #ifndef WEBRTC_ANDROID | 317 #endif |
| 318 #ifdef WEBRTC_CODEC_ISAC |
317 // Load iSAC SWB. | 319 // Load iSAC SWB. |
318 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderISACswb, 104)); | 320 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderISACswb, 104)); |
319 // Load iSAC FB. | 321 // Load iSAC FB. |
320 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderISACfb, 105)); | 322 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderISACfb, 105)); |
321 #endif // WEBRTC_ANDROID | 323 #endif |
322 // Load PCM16B nb. | 324 // Load PCM16B nb. |
323 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCM16B, 93)); | 325 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCM16B, 93)); |
324 // Load PCM16B wb. | 326 // Load PCM16B wb. |
325 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCM16Bwb, 94)); | 327 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCM16Bwb, 94)); |
326 // Load PCM16B swb32. | 328 // Load PCM16B swb32. |
327 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCM16Bswb32kHz, 95)); | 329 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderPCM16Bswb32kHz, 95)); |
328 // Load CNG 8 kHz. | 330 // Load CNG 8 kHz. |
329 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderCNGnb, 13)); | 331 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderCNGnb, 13)); |
330 // Load CNG 16 kHz. | 332 // Load CNG 16 kHz. |
331 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderCNGwb, 98)); | 333 ASSERT_EQ(0, neteq_->RegisterPayloadType(kDecoderCNGwb, 98)); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 size_t* payload_len) { | 436 size_t* payload_len) { |
435 rtp_info->header.sequenceNumber = frame_index; | 437 rtp_info->header.sequenceNumber = frame_index; |
436 rtp_info->header.timestamp = timestamp; | 438 rtp_info->header.timestamp = timestamp; |
437 rtp_info->header.ssrc = 0x1234; // Just an arbitrary SSRC. | 439 rtp_info->header.ssrc = 0x1234; // Just an arbitrary SSRC. |
438 rtp_info->header.payloadType = 98; // WB CNG. | 440 rtp_info->header.payloadType = 98; // WB CNG. |
439 rtp_info->header.markerBit = 0; | 441 rtp_info->header.markerBit = 0; |
440 payload[0] = 64; // Noise level -64 dBov, quite arbitrarily chosen. | 442 payload[0] = 64; // Noise level -64 dBov, quite arbitrarily chosen. |
441 *payload_len = 1; // Only noise level, no spectral parameters. | 443 *payload_len = 1; // Only noise level, no spectral parameters. |
442 } | 444 } |
443 | 445 |
| 446 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISAC)) && \ |
| 447 defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722) |
| 448 #define IF_ALL_CODECS(x) x |
| 449 #else |
| 450 #define IF_ALL_CODECS(x) DISABLED_##x |
| 451 #endif |
| 452 |
444 TEST_F(NetEqDecodingTest, | 453 TEST_F(NetEqDecodingTest, |
445 DISABLED_ON_IOS(DISABLED_ON_ANDROID(TestBitExactness))) { | 454 DISABLED_ON_IOS(DISABLED_ON_ANDROID(IF_ALL_CODECS(TestBitExactness)))) { |
446 const std::string input_rtp_file = webrtc::test::ProjectRootPath() + | 455 const std::string input_rtp_file = webrtc::test::ProjectRootPath() + |
447 "resources/audio_coding/neteq_universal_new.rtp"; | 456 "resources/audio_coding/neteq_universal_new.rtp"; |
448 // Note that neteq4_universal_ref.pcm and neteq4_universal_ref_win_32.pcm | 457 // Note that neteq4_universal_ref.pcm and neteq4_universal_ref_win_32.pcm |
449 // are identical. The latter could have been removed, but if clients still | 458 // are identical. The latter could have been removed, but if clients still |
450 // have a copy of the file, the test will fail. | 459 // have a copy of the file, the test will fail. |
451 const std::string input_ref_file = | 460 const std::string input_ref_file = |
452 webrtc::test::ResourcePath("audio_coding/neteq4_universal_ref", "pcm"); | 461 webrtc::test::ResourcePath("audio_coding/neteq4_universal_ref", "pcm"); |
453 #if defined(_MSC_VER) && (_MSC_VER >= 1700) | 462 #if defined(_MSC_VER) && (_MSC_VER >= 1700) |
454 // For Visual Studio 2012 and later, we will have to use the generic reference | 463 // For Visual Studio 2012 and later, we will have to use the generic reference |
455 // file, rather than the windows-specific one. | 464 // file, rather than the windows-specific one. |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 const size_t kPayloadBytes = 100; | 822 const size_t kPayloadBytes = 100; |
814 uint8_t payload[kPayloadBytes] = {0}; | 823 uint8_t payload[kPayloadBytes] = {0}; |
815 WebRtcRTPHeader rtp_info; | 824 WebRtcRTPHeader rtp_info; |
816 PopulateRtpInfo(0, 0, &rtp_info); | 825 PopulateRtpInfo(0, 0, &rtp_info); |
817 rtp_info.header.payloadType = 1; // Not registered as a decoder. | 826 rtp_info.header.payloadType = 1; // Not registered as a decoder. |
818 EXPECT_EQ(NetEq::kFail, | 827 EXPECT_EQ(NetEq::kFail, |
819 neteq_->InsertPacket(rtp_info, payload, kPayloadBytes, 0)); | 828 neteq_->InsertPacket(rtp_info, payload, kPayloadBytes, 0)); |
820 EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError()); | 829 EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError()); |
821 } | 830 } |
822 | 831 |
823 TEST_F(NetEqDecodingTest, DISABLED_ON_ANDROID(DecoderError)) { | 832 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) |
| 833 #define IF_ISAC(x) x |
| 834 #else |
| 835 #define IF_ISAC(x) DISABLED_##x |
| 836 #endif |
| 837 |
| 838 TEST_F(NetEqDecodingTest, DISABLED_ON_ANDROID(IF_ISAC(DecoderError))) { |
824 const size_t kPayloadBytes = 100; | 839 const size_t kPayloadBytes = 100; |
825 uint8_t payload[kPayloadBytes] = {0}; | 840 uint8_t payload[kPayloadBytes] = {0}; |
826 WebRtcRTPHeader rtp_info; | 841 WebRtcRTPHeader rtp_info; |
827 PopulateRtpInfo(0, 0, &rtp_info); | 842 PopulateRtpInfo(0, 0, &rtp_info); |
828 rtp_info.header.payloadType = 103; // iSAC, but the payload is invalid. | 843 rtp_info.header.payloadType = 103; // iSAC, but the payload is invalid. |
829 EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, kPayloadBytes, 0)); | 844 EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, kPayloadBytes, 0)); |
830 NetEqOutputType type; | 845 NetEqOutputType type; |
831 // Set all of |out_data_| to 1, and verify that it was set to 0 by the call | 846 // Set all of |out_data_| to 1, and verify that it was set to 0 by the call |
832 // to GetAudio. | 847 // to GetAudio. |
833 for (size_t i = 0; i < kMaxBlockSize; ++i) { | 848 for (size_t i = 0; i < kMaxBlockSize; ++i) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 CheckBgn(16000); | 1059 CheckBgn(16000); |
1045 CheckBgn(32000); | 1060 CheckBgn(32000); |
1046 } | 1061 } |
1047 | 1062 |
1048 TEST_F(NetEqBgnTestFade, RunTest) { | 1063 TEST_F(NetEqBgnTestFade, RunTest) { |
1049 CheckBgn(8000); | 1064 CheckBgn(8000); |
1050 CheckBgn(16000); | 1065 CheckBgn(16000); |
1051 CheckBgn(32000); | 1066 CheckBgn(32000); |
1052 } | 1067 } |
1053 | 1068 |
1054 TEST_F(NetEqDecodingTest, SyncPacketInsert) { | 1069 TEST_F(NetEqDecodingTest, IF_ISAC(SyncPacketInsert)) { |
1055 WebRtcRTPHeader rtp_info; | 1070 WebRtcRTPHeader rtp_info; |
1056 uint32_t receive_timestamp = 0; | 1071 uint32_t receive_timestamp = 0; |
1057 // For the readability use the following payloads instead of the defaults of | 1072 // For the readability use the following payloads instead of the defaults of |
1058 // this test. | 1073 // this test. |
1059 uint8_t kPcm16WbPayloadType = 1; | 1074 uint8_t kPcm16WbPayloadType = 1; |
1060 uint8_t kCngNbPayloadType = 2; | 1075 uint8_t kCngNbPayloadType = 2; |
1061 uint8_t kCngWbPayloadType = 3; | 1076 uint8_t kCngWbPayloadType = 3; |
1062 uint8_t kCngSwb32PayloadType = 4; | 1077 uint8_t kCngSwb32PayloadType = 4; |
1063 uint8_t kCngSwb48PayloadType = 5; | 1078 uint8_t kCngSwb48PayloadType = 5; |
1064 uint8_t kAvtPayloadType = 6; | 1079 uint8_t kAvtPayloadType = 6; |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 // Pull audio once. | 1527 // Pull audio once. |
1513 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len, | 1528 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len, |
1514 &num_channels, &type)); | 1529 &num_channels, &type)); |
1515 ASSERT_EQ(kBlockSize16kHz, out_len); | 1530 ASSERT_EQ(kBlockSize16kHz, out_len); |
1516 } | 1531 } |
1517 // Verify speech output. | 1532 // Verify speech output. |
1518 EXPECT_EQ(kOutputNormal, type); | 1533 EXPECT_EQ(kOutputNormal, type); |
1519 } | 1534 } |
1520 | 1535 |
1521 } // namespace webrtc | 1536 } // namespace webrtc |
OLD | NEW |