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