Chromium Code Reviews| 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/TestAllCodecs.h" | 11 #include "webrtc/modules/audio_coding/test/TestAllCodecs.h" |
| 12 | 12 |
| 13 #include <cstdio> | 13 #include <cstdio> |
| 14 #include <limits> | 14 #include <limits> |
| 15 #include <string> | 15 #include <string> |
| 16 | 16 |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 #include "webrtc/base/checks.h" | |
| 19 #include "webrtc/common_types.h" | 20 #include "webrtc/common_types.h" |
| 20 #include "webrtc/engine_configurations.h" | 21 #include "webrtc/engine_configurations.h" |
| 21 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | 22 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" |
| 22 #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" | 23 #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" |
| 23 #include "webrtc/modules/audio_coding/test/utility.h" | 24 #include "webrtc/modules/audio_coding/test/utility.h" |
| 24 #include "webrtc/system_wrappers/include/trace.h" | 25 #include "webrtc/system_wrappers/include/trace.h" |
| 25 #include "webrtc/test/testsupport/fileutils.h" | 26 #include "webrtc/test/testsupport/fileutils.h" |
| 26 #include "webrtc/typedefs.h" | 27 #include "webrtc/typedefs.h" |
| 27 | 28 |
| 28 // Description of the test: | 29 // Description of the test: |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 } | 416 } |
| 416 | 417 |
| 417 void TestAllCodecs::Run(TestPack* channel) { | 418 void TestAllCodecs::Run(TestPack* channel) { |
| 418 AudioFrame audio_frame; | 419 AudioFrame audio_frame; |
| 419 | 420 |
| 420 int32_t out_freq_hz = outfile_b_.SamplingFrequency(); | 421 int32_t out_freq_hz = outfile_b_.SamplingFrequency(); |
| 421 size_t receive_size; | 422 size_t receive_size; |
| 422 uint32_t timestamp_diff; | 423 uint32_t timestamp_diff; |
| 423 channel->reset_payload_size(); | 424 channel->reset_payload_size(); |
| 424 int error_count = 0; | 425 int error_count = 0; |
| 426 int counter = 0; | |
| 427 static const int kTestLengthMs = 500; | |
| 428 const int test_length_blocks = rtc::CheckedDivExact(kTestLengthMs, 10); | |
| 429 infile_a_.SetNum10MsBlocksToRead(test_length_blocks); | |
|
ivoc
2015/12/10 12:23:57
You could consider hardcoding the number of blocks
hlundin-webrtc
2015/12/10 12:49:59
Done.
| |
| 430 // Fast-forward 1 second (100 blocks) since the file starts with silence. | |
| 431 infile_a_.FastForward(100); | |
| 425 | 432 |
| 426 int counter = 0; | |
| 427 while (!infile_a_.EndOfFile()) { | 433 while (!infile_a_.EndOfFile()) { |
| 428 // Add 10 msec to ACM. | 434 // Add 10 msec to ACM. |
| 429 infile_a_.Read10MsData(audio_frame); | 435 infile_a_.Read10MsData(audio_frame); |
| 430 CHECK_ERROR(acm_a_->Add10MsData(audio_frame)); | 436 CHECK_ERROR(acm_a_->Add10MsData(audio_frame)); |
| 431 | 437 |
| 432 // Verify that the received packet size matches the settings. | 438 // Verify that the received packet size matches the settings. |
| 433 receive_size = channel->payload_size(); | 439 receive_size = channel->payload_size(); |
| 434 if (receive_size) { | 440 if (receive_size) { |
| 435 if ((receive_size != packet_size_bytes_) && | 441 if ((receive_size != packet_size_bytes_) && |
| 436 (packet_size_bytes_ != kVariableSize)) { | 442 (packet_size_bytes_ != kVariableSize)) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 } | 482 } |
| 477 | 483 |
| 478 void TestAllCodecs::DisplaySendReceiveCodec() { | 484 void TestAllCodecs::DisplaySendReceiveCodec() { |
| 479 CodecInst my_codec_param; | 485 CodecInst my_codec_param; |
| 480 printf("%s -> ", acm_a_->SendCodec()->plname); | 486 printf("%s -> ", acm_a_->SendCodec()->plname); |
| 481 acm_b_->ReceiveCodec(&my_codec_param); | 487 acm_b_->ReceiveCodec(&my_codec_param); |
| 482 printf("%s\n", my_codec_param.plname); | 488 printf("%s\n", my_codec_param.plname); |
| 483 } | 489 } |
| 484 | 490 |
| 485 } // namespace webrtc | 491 } // namespace webrtc |
| OLD | NEW |