diff options
author | Android Chromium Automerger <chromium-automerger@android> | 2014-07-29 12:29:13 +0000 |
---|---|---|
committer | Android Chromium Automerger <chromium-automerger@android> | 2014-07-29 12:29:13 +0000 |
commit | fa5085428e6672f7f9e88a652e3c4a7f9c93d116 (patch) | |
tree | ef453f1196cff48f99c0b0f45a95c11a4fd49b97 /modules/audio_coding/codecs/opus/opus_fec_test.cc | |
parent | f3d27028ce9a280c02c286f9b98adf1e476c03d2 (diff) | |
parent | 4a1b3e3a69d349b0d3e91f607f24e02d8b975688 (diff) | |
download | webrtc-fa5085428e6672f7f9e88a652e3c4a7f9c93d116.tar.gz |
Merge third_party/webrtc from https://chromium.googlesource.com/external/webrtc/trunk/webrtc.git at 4a1b3e3a69d349b0d3e91f607f24e02d8b975688
This commit was generated by merge_from_chromium.py.
Change-Id: Iada7abd78f123301a98db982a6272cd9487de72f
Diffstat (limited to 'modules/audio_coding/codecs/opus/opus_fec_test.cc')
-rw-r--r-- | modules/audio_coding/codecs/opus/opus_fec_test.cc | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/modules/audio_coding/codecs/opus/opus_fec_test.cc b/modules/audio_coding/codecs/opus/opus_fec_test.cc index fb4cb04f..ee027e80 100644 --- a/modules/audio_coding/codecs/opus/opus_fec_test.cc +++ b/modules/audio_coding/codecs/opus/opus_fec_test.cc @@ -32,8 +32,7 @@ struct mode { }; const int kOpusBlockDurationMs = 20; -const int kOpusInputSamplingKhz = 48; -const int kOpusOutputSamplingKhz = 32; +const int kOpusSamplingKhz = 48; class OpusFecTest : public TestWithParam<coding_param> { protected: @@ -47,14 +46,8 @@ class OpusFecTest : public TestWithParam<coding_param> { virtual void DecodeABlock(bool lost_previous, bool lost_current); int block_duration_ms_; - int input_sampling_khz_; - int output_sampling_khz_; - - // Number of samples-per-channel in a frame. - int input_length_sample_; - - // Expected output number of samples-per-channel in a frame. - int output_length_sample_; + int sampling_khz_; + int block_length_sample_; int channels_; int bit_rate_; @@ -91,7 +84,7 @@ void OpusFecTest::SetUp() { // Allocate memory to contain the whole file. in_data_.reset(new int16_t[loop_length_samples_ + - input_length_sample_ * channels_]); + block_length_sample_ * channels_]); // Copy the file into the buffer. ASSERT_EQ(fread(&in_data_[0], sizeof(int16_t), loop_length_samples_, fp), @@ -104,12 +97,12 @@ void OpusFecTest::SetUp() { // beginning of the array. Audio frames cross the end of the excerpt always // appear as a continuum of memory. memcpy(&in_data_[loop_length_samples_], &in_data_[0], - input_length_sample_ * channels_ * sizeof(int16_t)); + block_length_sample_ * channels_ * sizeof(int16_t)); // Maximum number of bytes in output bitstream. - max_bytes_ = input_length_sample_ * channels_ * sizeof(int16_t); + max_bytes_ = block_length_sample_ * channels_ * sizeof(int16_t); - out_data_.reset(new int16_t[2 * output_length_sample_ * channels_]); + out_data_.reset(new int16_t[2 * block_length_sample_ * channels_]); bit_stream_.reset(new uint8_t[max_bytes_]); // Create encoder memory. @@ -127,10 +120,8 @@ void OpusFecTest::TearDown() { OpusFecTest::OpusFecTest() : block_duration_ms_(kOpusBlockDurationMs), - input_sampling_khz_(kOpusInputSamplingKhz), - output_sampling_khz_(kOpusOutputSamplingKhz), - input_length_sample_(block_duration_ms_ * input_sampling_khz_), - output_length_sample_(block_duration_ms_ * output_sampling_khz_), + sampling_khz_(kOpusSamplingKhz), + block_length_sample_(block_duration_ms_ * sampling_khz_), data_pointer_(0), max_bytes_(0), encoded_bytes_(0), @@ -141,7 +132,7 @@ OpusFecTest::OpusFecTest() void OpusFecTest::EncodeABlock() { int16_t value = WebRtcOpus_Encode(opus_encoder_, &in_data_[data_pointer_], - input_length_sample_, + block_length_sample_, max_bytes_, &bit_stream_[0]); EXPECT_GT(value, 0); @@ -162,7 +153,7 @@ void OpusFecTest::DecodeABlock(bool lost_previous, bool lost_current) { } else { value_1 = WebRtcOpus_DecodePlc(opus_decoder_, &out_data_[0], 1); } - EXPECT_EQ(output_length_sample_, value_1); + EXPECT_EQ(block_length_sample_, value_1); } if (!lost_current) { @@ -171,7 +162,7 @@ void OpusFecTest::DecodeABlock(bool lost_previous, bool lost_current) { encoded_bytes_, &out_data_[value_1 * channels_], &audio_type); - EXPECT_EQ(output_length_sample_, value_2); + EXPECT_EQ(block_length_sample_, value_2); } } @@ -224,7 +215,7 @@ TEST_P(OpusFecTest, RandomPacketLossTest) { // |data_pointer_| is incremented and wrapped across // |loop_length_samples_|. - data_pointer_ = (data_pointer_ + input_length_sample_ * channels_) % + data_pointer_ = (data_pointer_ + block_length_sample_ * channels_) % loop_length_samples_; } if (mode_set[i].fec) { |