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

Side by Side Diff: webrtc/modules/audio_coding/test/TestStereo.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: Fixing win64 build 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
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 int percent_loss) { 728 int percent_loss) {
729 AudioFrame audio_frame; 729 AudioFrame audio_frame;
730 730
731 int32_t out_freq_hz_b = out_file_.SamplingFrequency(); 731 int32_t out_freq_hz_b = out_file_.SamplingFrequency();
732 uint16_t rec_size; 732 uint16_t rec_size;
733 uint32_t time_stamp_diff; 733 uint32_t time_stamp_diff;
734 channel->reset_payload_size(); 734 channel->reset_payload_size();
735 int error_count = 0; 735 int error_count = 0;
736 int variable_bytes = 0; 736 int variable_bytes = 0;
737 int variable_packets = 0; 737 int variable_packets = 0;
738 // Set test length to 500 ms (50 blocks of 10 ms each).
739 in_file_mono_->SetNum10MsBlocksToRead(50);
740 in_file_stereo_->SetNum10MsBlocksToRead(50);
741 // Fast-forward 1 second (100 blocks) since the files start with silence.
742 in_file_stereo_->FastForward(100);
743 in_file_mono_->FastForward(100);
738 744
739 while (1) { 745 while (1) {
740 // Simulate packet loss by setting |packet_loss_| to "true" in 746 // Simulate packet loss by setting |packet_loss_| to "true" in
741 // |percent_loss| percent of the loops. 747 // |percent_loss| percent of the loops.
742 if (percent_loss > 0) { 748 if (percent_loss > 0) {
743 if (counter_ == floor((100 / percent_loss) + 0.5)) { 749 if (counter_ == floor((100 / percent_loss) + 0.5)) {
744 counter_ = 0; 750 counter_ = 0;
745 channel->set_lost_packet(true); 751 channel->set_lost_packet(true);
746 } else { 752 } else {
747 channel->set_lost_packet(false); 753 channel->set_lost_packet(false);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 audio_frame.data_, 799 audio_frame.data_,
794 audio_frame.samples_per_channel_ * audio_frame.num_channels_); 800 audio_frame.samples_per_channel_ * audio_frame.num_channels_);
795 } 801 }
796 802
797 EXPECT_EQ(0, error_count); 803 EXPECT_EQ(0, error_count);
798 804
799 // Check that packet size is in the right range for variable rate codecs, 805 // Check that packet size is in the right range for variable rate codecs,
800 // such as Opus. 806 // such as Opus.
801 if (variable_packets > 0) { 807 if (variable_packets > 0) {
802 variable_bytes /= variable_packets; 808 variable_bytes /= variable_packets;
803 EXPECT_NEAR(variable_bytes, pack_size_bytes_, 3); 809 EXPECT_NEAR(variable_bytes, pack_size_bytes_, 18);
804 } 810 }
805 811
806 if (in_file_mono_->EndOfFile()) { 812 if (in_file_mono_->EndOfFile()) {
807 in_file_mono_->Rewind(); 813 in_file_mono_->Rewind();
808 } 814 }
809 if (in_file_stereo_->EndOfFile()) { 815 if (in_file_stereo_->EndOfFile()) {
810 in_file_stereo_->Rewind(); 816 in_file_stereo_->Rewind();
811 } 817 }
812 // Reset in case we ended with a lost packet 818 // Reset in case we ended with a lost packet
813 channel->set_lost_packet(false); 819 channel->set_lost_packet(false);
(...skipping 15 matching lines...) Expand all
829 printf("%s -> ", send_codec->plname); 835 printf("%s -> ", send_codec->plname);
830 } 836 }
831 CodecInst receive_codec; 837 CodecInst receive_codec;
832 acm_b_->ReceiveCodec(&receive_codec); 838 acm_b_->ReceiveCodec(&receive_codec);
833 if (test_mode_ != 0) { 839 if (test_mode_ != 0) {
834 printf("%s\n", receive_codec.plname); 840 printf("%s\n", receive_codec.plname);
835 } 841 }
836 } 842 }
837 843
838 } // namespace webrtc 844 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/test/TestRedFec.cc ('k') | webrtc/modules/audio_coding/test/TestVADDTX.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698