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

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

Issue 1353803002: Simple cleanups of AudioDecoder and AudioEncoder classes (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@dmove-isac
Patch Set: rebase Created 5 years, 2 months 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 AudioEncoder::EncodedInfo encoded_info_; 279 AudioEncoder::EncodedInfo encoded_info_;
280 AudioDecoder* decoder_; 280 AudioDecoder* decoder_;
281 rtc::scoped_ptr<AudioEncoder> audio_encoder_; 281 rtc::scoped_ptr<AudioEncoder> audio_encoder_;
282 }; 282 };
283 283
284 class AudioDecoderPcmUTest : public AudioDecoderTest { 284 class AudioDecoderPcmUTest : public AudioDecoderTest {
285 protected: 285 protected:
286 AudioDecoderPcmUTest() : AudioDecoderTest() { 286 AudioDecoderPcmUTest() : AudioDecoderTest() {
287 frame_size_ = 160; 287 frame_size_ = 160;
288 data_length_ = 10 * frame_size_; 288 data_length_ = 10 * frame_size_;
289 decoder_ = new AudioDecoderPcmU; 289 decoder_ = new AudioDecoderPcmU(1);
290 AudioEncoderPcmU::Config config; 290 AudioEncoderPcmU::Config config;
291 config.frame_size_ms = static_cast<int>(frame_size_ / 8); 291 config.frame_size_ms = static_cast<int>(frame_size_ / 8);
292 config.payload_type = payload_type_; 292 config.payload_type = payload_type_;
293 audio_encoder_.reset(new AudioEncoderPcmU(config)); 293 audio_encoder_.reset(new AudioEncoderPcmU(config));
294 } 294 }
295 }; 295 };
296 296
297 class AudioDecoderPcmATest : public AudioDecoderTest { 297 class AudioDecoderPcmATest : public AudioDecoderTest {
298 protected: 298 protected:
299 AudioDecoderPcmATest() : AudioDecoderTest() { 299 AudioDecoderPcmATest() : AudioDecoderTest() {
300 frame_size_ = 160; 300 frame_size_ = 160;
301 data_length_ = 10 * frame_size_; 301 data_length_ = 10 * frame_size_;
302 decoder_ = new AudioDecoderPcmA; 302 decoder_ = new AudioDecoderPcmA(1);
303 AudioEncoderPcmA::Config config; 303 AudioEncoderPcmA::Config config;
304 config.frame_size_ms = static_cast<int>(frame_size_ / 8); 304 config.frame_size_ms = static_cast<int>(frame_size_ / 8);
305 config.payload_type = payload_type_; 305 config.payload_type = payload_type_;
306 audio_encoder_.reset(new AudioEncoderPcmA(config)); 306 audio_encoder_.reset(new AudioEncoderPcmA(config));
307 } 307 }
308 }; 308 };
309 309
310 class AudioDecoderPcm16BTest : public AudioDecoderTest { 310 class AudioDecoderPcm16BTest : public AudioDecoderTest {
311 protected: 311 protected:
312 AudioDecoderPcm16BTest() : AudioDecoderTest() { 312 AudioDecoderPcm16BTest() : AudioDecoderTest() {
313 codec_input_rate_hz_ = 16000; 313 codec_input_rate_hz_ = 16000;
314 frame_size_ = 20 * codec_input_rate_hz_ / 1000; 314 frame_size_ = 20 * codec_input_rate_hz_ / 1000;
315 data_length_ = 10 * frame_size_; 315 data_length_ = 10 * frame_size_;
316 decoder_ = new AudioDecoderPcm16B; 316 decoder_ = new AudioDecoderPcm16B(1);
317 assert(decoder_); 317 assert(decoder_);
318 AudioEncoderPcm16B::Config config; 318 AudioEncoderPcm16B::Config config;
319 config.sample_rate_hz = codec_input_rate_hz_; 319 config.sample_rate_hz = codec_input_rate_hz_;
320 config.frame_size_ms = 320 config.frame_size_ms =
321 static_cast<int>(frame_size_ / (config.sample_rate_hz / 1000)); 321 static_cast<int>(frame_size_ / (config.sample_rate_hz / 1000));
322 config.payload_type = payload_type_; 322 config.payload_type = payload_type_;
323 audio_encoder_.reset(new AudioEncoderPcm16B(config)); 323 audio_encoder_.reset(new AudioEncoderPcm16B(config));
324 } 324 }
325 }; 325 };
326 326
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 EXPECT_TRUE(CodecSupported(kDecoderCNGnb)); 726 EXPECT_TRUE(CodecSupported(kDecoderCNGnb));
727 EXPECT_TRUE(CodecSupported(kDecoderCNGwb)); 727 EXPECT_TRUE(CodecSupported(kDecoderCNGwb));
728 EXPECT_TRUE(CodecSupported(kDecoderCNGswb32kHz)); 728 EXPECT_TRUE(CodecSupported(kDecoderCNGswb32kHz));
729 EXPECT_TRUE(CodecSupported(kDecoderCNGswb48kHz)); 729 EXPECT_TRUE(CodecSupported(kDecoderCNGswb48kHz));
730 EXPECT_TRUE(CodecSupported(kDecoderArbitrary)); 730 EXPECT_TRUE(CodecSupported(kDecoderArbitrary));
731 EXPECT_TRUE(CodecSupported(kDecoderOpus)); 731 EXPECT_TRUE(CodecSupported(kDecoderOpus));
732 EXPECT_TRUE(CodecSupported(kDecoderOpus_2ch)); 732 EXPECT_TRUE(CodecSupported(kDecoderOpus_2ch));
733 } 733 }
734 734
735 } // namespace webrtc 735 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698