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

Side by Side Diff: webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc

Issue 1418423010: Pass audio to AudioEncoder::Encode() in an ArrayView (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 1 month 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 for (size_t i = 0; i < audio_encoder_->Num10MsFramesInNextPacket(); ++i) { 151 for (size_t i = 0; i < audio_encoder_->Num10MsFramesInNextPacket(); ++i) {
152 EXPECT_EQ(0u, encoded_info_.encoded_bytes); 152 EXPECT_EQ(0u, encoded_info_.encoded_bytes);
153 153
154 // Duplicate the mono input signal to however many channels the test 154 // Duplicate the mono input signal to however many channels the test
155 // wants. 155 // wants.
156 test::InputAudioFile::DuplicateInterleaved(input + i * samples_per_10ms, 156 test::InputAudioFile::DuplicateInterleaved(input + i * samples_per_10ms,
157 samples_per_10ms, channels_, 157 samples_per_10ms, channels_,
158 interleaved_input.get()); 158 interleaved_input.get());
159 159
160 encoded_info_ = audio_encoder_->Encode( 160 encoded_info_ = audio_encoder_->Encode(
161 0, interleaved_input.get(), audio_encoder_->SampleRateHz() / 100, 161 0, rtc::ArrayView<const int16_t>(interleaved_input.get(),
162 audio_encoder_->NumChannels() *
163 audio_encoder_->SampleRateHz() /
164 100),
162 data_length_ * 2, output); 165 data_length_ * 2, output);
163 } 166 }
164 EXPECT_EQ(payload_type_, encoded_info_.payload_type); 167 EXPECT_EQ(payload_type_, encoded_info_.payload_type);
165 return static_cast<int>(encoded_info_.encoded_bytes); 168 return static_cast<int>(encoded_info_.encoded_bytes);
166 } 169 }
167 170
168 // Encodes and decodes audio. The absolute difference between the input and 171 // Encodes and decodes audio. The absolute difference between the input and
169 // output is compared vs |tolerance|, and the mean-squared error is compared 172 // output is compared vs |tolerance|, and the mean-squared error is compared
170 // with |mse|. The encoded stream should contain |expected_bytes|. For stereo 173 // with |mse|. The encoded stream should contain |expected_bytes|. For stereo
171 // audio, the absolute difference between the two channels is compared vs 174 // audio, the absolute difference between the two channels is compared vs
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGnb)); 746 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGnb));
744 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGwb)); 747 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGwb));
745 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb32kHz)); 748 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb32kHz));
746 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb48kHz)); 749 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb48kHz));
747 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderArbitrary)); 750 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderArbitrary));
748 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus)); 751 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus));
749 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus_2ch)); 752 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus_2ch));
750 } 753 }
751 754
752 } // namespace webrtc 755 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/codec_owner_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/neteq_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698