| 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 27 matching lines...) Expand all Loading... |
| 38 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD | 38 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
| 39 #include "external/webrtc/webrtc/modules/audio_coding/neteq/neteq_unittest.pb.h" | 39 #include "external/webrtc/webrtc/modules/audio_coding/neteq/neteq_unittest.pb.h" |
| 40 #else | 40 #else |
| 41 #include "webrtc/audio_coding/neteq/neteq_unittest.pb.h" | 41 #include "webrtc/audio_coding/neteq/neteq_unittest.pb.h" |
| 42 #endif | 42 #endif |
| 43 RTC_POP_IGNORING_WUNDEF() | 43 RTC_POP_IGNORING_WUNDEF() |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 DEFINE_bool(gen_ref, false, "Generate reference files."); | 46 DEFINE_bool(gen_ref, false, "Generate reference files."); |
| 47 | 47 |
| 48 namespace webrtc { |
| 49 |
| 48 namespace { | 50 namespace { |
| 49 | 51 |
| 50 const std::string& PlatformChecksum(const std::string& checksum_general, | 52 const std::string& PlatformChecksum(const std::string& checksum_general, |
| 51 const std::string& checksum_android, | 53 const std::string& checksum_android, |
| 52 const std::string& checksum_win_32, | 54 const std::string& checksum_win_32, |
| 53 const std::string& checksum_win_64) { | 55 const std::string& checksum_win_64) { |
| 54 #if defined(WEBRTC_ANDROID) | 56 #if defined(WEBRTC_ANDROID) |
| 55 return checksum_android; | 57 return checksum_android; |
| 56 #elif defined(WEBRTC_WIN) | 58 #elif defined(WEBRTC_WIN) |
| 57 #ifdef WEBRTC_ARCH_64_BITS | 59 #ifdef WEBRTC_ARCH_64_BITS |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 105 |
| 104 if (file) | 106 if (file) |
| 105 ASSERT_EQ(static_cast<size_t>(size), | 107 ASSERT_EQ(static_cast<size_t>(size), |
| 106 fwrite(message.data(), sizeof(char), size, file)); | 108 fwrite(message.data(), sizeof(char), size, file)); |
| 107 digest->Update(message.data(), sizeof(char) * size); | 109 digest->Update(message.data(), sizeof(char) * size); |
| 108 } | 110 } |
| 109 | 111 |
| 110 #endif // WEBRTC_NETEQ_UNITTEST_BITEXACT | 112 #endif // WEBRTC_NETEQ_UNITTEST_BITEXACT |
| 111 | 113 |
| 112 void LoadDecoders(webrtc::NetEq* neteq) { | 114 void LoadDecoders(webrtc::NetEq* neteq) { |
| 113 // Load PCMu. | 115 ASSERT_EQ(true, |
| 114 ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderPCMu, | 116 neteq->RegisterPayloadType(0, SdpAudioFormat("pcmu", 8000, 1))); |
| 115 "pcmu", 0)); | 117 // Use non-SdpAudioFormat argument when registering PCMa, so that we get test |
| 116 // Load PCMa. | 118 // coverage for that as well. |
| 117 ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderPCMa, | 119 ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderPCMa, |
| 118 "pcma", 8)); | 120 "pcma", 8)); |
| 119 #ifdef WEBRTC_CODEC_ILBC | 121 #ifdef WEBRTC_CODEC_ILBC |
| 120 // Load iLBC. | 122 ASSERT_EQ(true, |
| 121 ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderILBC, | 123 neteq->RegisterPayloadType(102, SdpAudioFormat("ilbc", 8000, 1))); |
| 122 "ilbc", 102)); | |
| 123 #endif | 124 #endif |
| 124 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) | 125 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) |
| 125 // Load iSAC. | 126 ASSERT_EQ(true, |
| 126 ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderISAC, | 127 neteq->RegisterPayloadType(103, SdpAudioFormat("isac", 16000, 1))); |
| 127 "isac", 103)); | |
| 128 #endif | 128 #endif |
| 129 #ifdef WEBRTC_CODEC_ISAC | 129 #ifdef WEBRTC_CODEC_ISAC |
| 130 // Load iSAC SWB. | 130 ASSERT_EQ(true, |
| 131 ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderISACswb, | 131 neteq->RegisterPayloadType(104, SdpAudioFormat("isac", 32000, 1))); |
| 132 "isac-swb", 104)); | |
| 133 #endif | 132 #endif |
| 134 #ifdef WEBRTC_CODEC_OPUS | 133 #ifdef WEBRTC_CODEC_OPUS |
| 135 ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderOpus, | 134 ASSERT_EQ(true, |
| 136 "opus", 111)); | 135 neteq->RegisterPayloadType( |
| 136 111, SdpAudioFormat("opus", 48000, 2, {{"stereo", "0"}}))); |
| 137 #endif | 137 #endif |
| 138 // Load PCM16B nb. | 138 ASSERT_EQ(true, |
| 139 ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderPCM16B, | 139 neteq->RegisterPayloadType(93, SdpAudioFormat("L16", 8000, 1))); |
| 140 "pcm16-nb", 93)); | 140 ASSERT_EQ(true, |
| 141 // Load PCM16B wb. | 141 neteq->RegisterPayloadType(94, SdpAudioFormat("L16", 16000, 1))); |
| 142 ASSERT_EQ(0, neteq->RegisterPayloadType( | 142 ASSERT_EQ(true, |
| 143 webrtc::NetEqDecoder::kDecoderPCM16Bwb, "pcm16-wb", 94)); | 143 neteq->RegisterPayloadType(95, SdpAudioFormat("L16", 32000, 1))); |
| 144 // Load PCM16B swb32. | 144 ASSERT_EQ(true, |
| 145 ASSERT_EQ( | 145 neteq->RegisterPayloadType(13, SdpAudioFormat("cn", 8000, 1))); |
| 146 0, neteq->RegisterPayloadType( | 146 ASSERT_EQ(true, |
| 147 webrtc::NetEqDecoder::kDecoderPCM16Bswb32kHz, "pcm16-swb32", 95)); | 147 neteq->RegisterPayloadType(98, SdpAudioFormat("cn", 16000, 1))); |
| 148 // Load CNG 8 kHz. | |
| 149 ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderCNGnb, | |
| 150 "cng-nb", 13)); | |
| 151 // Load CNG 16 kHz. | |
| 152 ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderCNGwb, | |
| 153 "cng-wb", 98)); | |
| 154 } | 148 } |
| 155 } // namespace | 149 } // namespace |
| 156 | 150 |
| 157 namespace webrtc { | |
| 158 | |
| 159 class ResultSink { | 151 class ResultSink { |
| 160 public: | 152 public: |
| 161 explicit ResultSink(const std::string& output_file); | 153 explicit ResultSink(const std::string& output_file); |
| 162 ~ResultSink(); | 154 ~ResultSink(); |
| 163 | 155 |
| 164 template<typename T, size_t n> void AddResult( | 156 template<typename T, size_t n> void AddResult( |
| 165 const T (&test_results)[n], | 157 const T (&test_results)[n], |
| 166 size_t length); | 158 size_t length); |
| 167 | 159 |
| 168 void AddResult(const NetEqNetworkStatistics& stats); | 160 void AddResult(const NetEqNetworkStatistics& stats); |
| (...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 if (muted) { | 1581 if (muted) { |
| 1590 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2)); | 1582 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2)); |
| 1591 } else { | 1583 } else { |
| 1592 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2)); | 1584 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2)); |
| 1593 } | 1585 } |
| 1594 } | 1586 } |
| 1595 EXPECT_FALSE(muted); | 1587 EXPECT_FALSE(muted); |
| 1596 } | 1588 } |
| 1597 | 1589 |
| 1598 } // namespace webrtc | 1590 } // namespace webrtc |
| OLD | NEW |