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 |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 samplingFreqHz, 1), -1); | 446 samplingFreqHz, 1), -1); |
447 EXPECT_GT(myACM->RegisterSendCodec(myCodecParam), -1); | 447 EXPECT_GT(myACM->RegisterSendCodec(myCodecParam), -1); |
448 | 448 |
449 // Initialization was successful. | 449 // Initialization was successful. |
450 return 0; | 450 return 0; |
451 } | 451 } |
452 | 452 |
453 void TestRedFec::Run() { | 453 void TestRedFec::Run() { |
454 AudioFrame audioFrame; | 454 AudioFrame audioFrame; |
455 int32_t outFreqHzB = _outFileB.SamplingFrequency(); | 455 int32_t outFreqHzB = _outFileB.SamplingFrequency(); |
| 456 // Set test length to 500 ms (50 blocks of 10 ms each). |
| 457 _inFileA.SetNum10MsBlocksToRead(50); |
| 458 // Fast-forward 1 second (100 blocks) since the file starts with silence. |
| 459 _inFileA.FastForward(100); |
456 | 460 |
457 while (!_inFileA.EndOfFile()) { | 461 while (!_inFileA.EndOfFile()) { |
458 EXPECT_GT(_inFileA.Read10MsData(audioFrame), 0); | 462 EXPECT_GT(_inFileA.Read10MsData(audioFrame), 0); |
459 EXPECT_GE(_acmA->Add10MsData(audioFrame), 0); | 463 EXPECT_GE(_acmA->Add10MsData(audioFrame), 0); |
460 EXPECT_EQ(0, _acmB->PlayoutData10Ms(outFreqHzB, &audioFrame)); | 464 EXPECT_EQ(0, _acmB->PlayoutData10Ms(outFreqHzB, &audioFrame)); |
461 _outFileB.Write10MsData(audioFrame.data_, audioFrame.samples_per_channel_); | 465 _outFileB.Write10MsData(audioFrame.data_, audioFrame.samples_per_channel_); |
462 } | 466 } |
463 _inFileA.Rewind(); | 467 _inFileA.Rewind(); |
464 } | 468 } |
465 | 469 |
466 void TestRedFec::OpenOutFile(int16_t test_number) { | 470 void TestRedFec::OpenOutFile(int16_t test_number) { |
467 std::string file_name; | 471 std::string file_name; |
468 std::stringstream file_stream; | 472 std::stringstream file_stream; |
469 file_stream << webrtc::test::OutputPath(); | 473 file_stream << webrtc::test::OutputPath(); |
470 file_stream << "TestRedFec_outFile_"; | 474 file_stream << "TestRedFec_outFile_"; |
471 file_stream << test_number << ".pcm"; | 475 file_stream << test_number << ".pcm"; |
472 file_name = file_stream.str(); | 476 file_name = file_stream.str(); |
473 _outFileB.Open(file_name, 16000, "wb"); | 477 _outFileB.Open(file_name, 16000, "wb"); |
474 } | 478 } |
475 | 479 |
476 } // namespace webrtc | 480 } // namespace webrtc |
OLD | NEW |