| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
| 11 #include "webrtc/modules/audio_coding/test/iSACTest.h" | 11 #include "webrtc/modules/audio_coding/test/iSACTest.h" |
| 12 | 12 |
| 13 #include <ctype.h> | 13 #include <ctype.h> |
| 14 #include <stdio.h> | 14 #include <stdio.h> |
| 15 #include <string.h> | 15 #include <string.h> |
| 16 | 16 |
| 17 #if _WIN32 | 17 #if _WIN32 |
| 18 #include <windows.h> | 18 #include <windows.h> |
| 19 #elif WEBRTC_LINUX | 19 #elif WEBRTC_LINUX |
| 20 #include <time.h> | 20 #include <time.h> |
| 21 #else | 21 #else |
| 22 #include <sys/time.h> | 22 #include <sys/time.h> |
| 23 #include <time.h> | 23 #include <time.h> |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 #include "webrtc/base/checks.h" |
| 26 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h" | 27 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h" |
| 27 #include "webrtc/modules/audio_coding/test/utility.h" | 28 #include "webrtc/modules/audio_coding/test/utility.h" |
| 28 #include "webrtc/system_wrappers/include/event_wrapper.h" | 29 #include "webrtc/system_wrappers/include/event_wrapper.h" |
| 29 #include "webrtc/system_wrappers/include/tick_util.h" | 30 #include "webrtc/system_wrappers/include/tick_util.h" |
| 30 #include "webrtc/system_wrappers/include/trace.h" | 31 #include "webrtc/system_wrappers/include/trace.h" |
| 31 #include "webrtc/test/testsupport/fileutils.h" | 32 #include "webrtc/test/testsupport/fileutils.h" |
| 32 | 33 |
| 33 namespace webrtc { | 34 namespace webrtc { |
| 34 | 35 |
| 35 void SetISACConfigDefault(ACMTestISACConfig& isacConfig) { | 36 void SetISACConfigDefault(ACMTestISACConfig& isacConfig) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 EXPECT_EQ(0, _acmB->RegisterTransportCallback(_channel_B2A.get())); | 111 EXPECT_EQ(0, _acmB->RegisterTransportCallback(_channel_B2A.get())); |
| 111 _channel_B2A->RegisterReceiverACM(_acmA.get()); | 112 _channel_B2A->RegisterReceiverACM(_acmA.get()); |
| 112 | 113 |
| 113 file_name_swb_ = webrtc::test::ResourcePath("audio_coding/testfile32kHz", | 114 file_name_swb_ = webrtc::test::ResourcePath("audio_coding/testfile32kHz", |
| 114 "pcm"); | 115 "pcm"); |
| 115 | 116 |
| 116 EXPECT_EQ(0, _acmB->RegisterSendCodec(_paramISAC16kHz)); | 117 EXPECT_EQ(0, _acmB->RegisterSendCodec(_paramISAC16kHz)); |
| 117 EXPECT_EQ(0, _acmA->RegisterSendCodec(_paramISAC32kHz)); | 118 EXPECT_EQ(0, _acmA->RegisterSendCodec(_paramISAC32kHz)); |
| 118 | 119 |
| 119 _inFileA.Open(file_name_swb_, 32000, "rb"); | 120 _inFileA.Open(file_name_swb_, 32000, "rb"); |
| 121 static const int kTestLengthMs = 500; |
| 122 const int test_length_blocks = rtc::CheckedDivExact(kTestLengthMs, 10); |
| 123 _inFileA.SetNum10MsBlocksToRead(test_length_blocks); |
| 124 // Fast-forward 1 second (100 blocks) since the files start with silence. |
| 125 _inFileA.FastForward(100); |
| 120 std::string fileNameA = webrtc::test::OutputPath() + "testisac_a.pcm"; | 126 std::string fileNameA = webrtc::test::OutputPath() + "testisac_a.pcm"; |
| 121 std::string fileNameB = webrtc::test::OutputPath() + "testisac_b.pcm"; | 127 std::string fileNameB = webrtc::test::OutputPath() + "testisac_b.pcm"; |
| 122 _outFileA.Open(fileNameA, 32000, "wb"); | 128 _outFileA.Open(fileNameA, 32000, "wb"); |
| 123 _outFileB.Open(fileNameB, 32000, "wb"); | 129 _outFileB.Open(fileNameB, 32000, "wb"); |
| 124 | 130 |
| 125 while (!_inFileA.EndOfFile()) { | 131 while (!_inFileA.EndOfFile()) { |
| 126 Run10ms(); | 132 Run10ms(); |
| 127 } | 133 } |
| 128 CodecInst receiveCodec; | 134 CodecInst receiveCodec; |
| 129 EXPECT_EQ(0, _acmA->ReceiveCodec(&receiveCodec)); | 135 EXPECT_EQ(0, _acmA->ReceiveCodec(&receiveCodec)); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 numSendCodecChanged++; | 336 numSendCodecChanged++; |
| 331 } | 337 } |
| 332 } | 338 } |
| 333 _outFileA.Close(); | 339 _outFileA.Close(); |
| 334 _outFileB.Close(); | 340 _outFileB.Close(); |
| 335 _inFileA.Close(); | 341 _inFileA.Close(); |
| 336 _inFileB.Close(); | 342 _inFileB.Close(); |
| 337 } | 343 } |
| 338 | 344 |
| 339 } // namespace webrtc | 345 } // namespace webrtc |
| OLD | NEW |