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

Side by Side Diff: webrtc/modules/audio_coding/test/TestRedFec.cc

Issue 1513223002: Reduce the runtime of some ACM tests in modules_tests (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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) 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/TestRedFec.h" 11 #include "webrtc/modules/audio_coding/test/TestRedFec.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 14
15 #include "webrtc/base/checks.h"
15 #include "webrtc/common.h" 16 #include "webrtc/common.h"
16 #include "webrtc/common_types.h" 17 #include "webrtc/common_types.h"
17 #include "webrtc/engine_configurations.h" 18 #include "webrtc/engine_configurations.h"
18 #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" 19 #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
19 #include "webrtc/modules/audio_coding/test/utility.h" 20 #include "webrtc/modules/audio_coding/test/utility.h"
20 #include "webrtc/system_wrappers/include/trace.h" 21 #include "webrtc/system_wrappers/include/trace.h"
21 #include "webrtc/test/testsupport/fileutils.h" 22 #include "webrtc/test/testsupport/fileutils.h"
22 23
23 #ifdef SUPPORT_RED_WB 24 #ifdef SUPPORT_RED_WB
24 #undef SUPPORT_RED_WB 25 #undef SUPPORT_RED_WB
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 samplingFreqHz, 1), -1); 447 samplingFreqHz, 1), -1);
447 EXPECT_GT(myACM->RegisterSendCodec(myCodecParam), -1); 448 EXPECT_GT(myACM->RegisterSendCodec(myCodecParam), -1);
448 449
449 // Initialization was successful. 450 // Initialization was successful.
450 return 0; 451 return 0;
451 } 452 }
452 453
453 void TestRedFec::Run() { 454 void TestRedFec::Run() {
454 AudioFrame audioFrame; 455 AudioFrame audioFrame;
455 int32_t outFreqHzB = _outFileB.SamplingFrequency(); 456 int32_t outFreqHzB = _outFileB.SamplingFrequency();
457 static const int kTestLengthMs = 500;
458 const int test_length_blocks = rtc::CheckedDivExact(kTestLengthMs, 10);
459 _inFileA.SetNum10MsBlocksToRead(test_length_blocks);
460 // Fast-forward 1 second (100 blocks) since the file starts with silence.
461 _inFileA.FastForward(100);
456 462
457 while (!_inFileA.EndOfFile()) { 463 while (!_inFileA.EndOfFile()) {
458 EXPECT_GT(_inFileA.Read10MsData(audioFrame), 0); 464 EXPECT_GT(_inFileA.Read10MsData(audioFrame), 0);
459 EXPECT_GE(_acmA->Add10MsData(audioFrame), 0); 465 EXPECT_GE(_acmA->Add10MsData(audioFrame), 0);
460 EXPECT_EQ(0, _acmB->PlayoutData10Ms(outFreqHzB, &audioFrame)); 466 EXPECT_EQ(0, _acmB->PlayoutData10Ms(outFreqHzB, &audioFrame));
461 _outFileB.Write10MsData(audioFrame.data_, audioFrame.samples_per_channel_); 467 _outFileB.Write10MsData(audioFrame.data_, audioFrame.samples_per_channel_);
462 } 468 }
463 _inFileA.Rewind(); 469 _inFileA.Rewind();
464 } 470 }
465 471
466 void TestRedFec::OpenOutFile(int16_t test_number) { 472 void TestRedFec::OpenOutFile(int16_t test_number) {
467 std::string file_name; 473 std::string file_name;
468 std::stringstream file_stream; 474 std::stringstream file_stream;
469 file_stream << webrtc::test::OutputPath(); 475 file_stream << webrtc::test::OutputPath();
470 file_stream << "TestRedFec_outFile_"; 476 file_stream << "TestRedFec_outFile_";
471 file_stream << test_number << ".pcm"; 477 file_stream << test_number << ".pcm";
472 file_name = file_stream.str(); 478 file_name = file_stream.str();
473 _outFileB.Open(file_name, 16000, "wb"); 479 _outFileB.Open(file_name, 16000, "wb");
474 } 480 }
475 481
476 } // namespace webrtc 482 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698