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

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

Issue 2024633002: AudioDecoder: New method SampleRateHz, + implementations for our codecs (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add TODO fix PCM A U at 8 kHz Created 4 years, 6 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
« no previous file with comments | « webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 audio_encoder_.reset(new AudioEncoderPcmA(config)); 303 audio_encoder_.reset(new AudioEncoderPcmA(config));
304 } 304 }
305 }; 305 };
306 306
307 class AudioDecoderPcm16BTest : public AudioDecoderTest { 307 class AudioDecoderPcm16BTest : public AudioDecoderTest {
308 protected: 308 protected:
309 AudioDecoderPcm16BTest() : AudioDecoderTest() { 309 AudioDecoderPcm16BTest() : AudioDecoderTest() {
310 codec_input_rate_hz_ = 16000; 310 codec_input_rate_hz_ = 16000;
311 frame_size_ = 20 * codec_input_rate_hz_ / 1000; 311 frame_size_ = 20 * codec_input_rate_hz_ / 1000;
312 data_length_ = 10 * frame_size_; 312 data_length_ = 10 * frame_size_;
313 decoder_ = new AudioDecoderPcm16B(1); 313 decoder_ = new AudioDecoderPcm16B(codec_input_rate_hz_, 1);
314 assert(decoder_); 314 assert(decoder_);
315 AudioEncoderPcm16B::Config config; 315 AudioEncoderPcm16B::Config config;
316 config.sample_rate_hz = codec_input_rate_hz_; 316 config.sample_rate_hz = codec_input_rate_hz_;
317 config.frame_size_ms = 317 config.frame_size_ms =
318 static_cast<int>(frame_size_ / (config.sample_rate_hz / 1000)); 318 static_cast<int>(frame_size_ / (config.sample_rate_hz / 1000));
319 config.payload_type = payload_type_; 319 config.payload_type = payload_type_;
320 audio_encoder_.reset(new AudioEncoderPcm16B(config)); 320 audio_encoder_.reset(new AudioEncoderPcm16B(config));
321 } 321 }
322 }; 322 };
323 323
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 codec_input_rate_hz_ = 16000; 363 codec_input_rate_hz_ = 16000;
364 frame_size_ = 480; 364 frame_size_ = 480;
365 data_length_ = 10 * frame_size_; 365 data_length_ = 10 * frame_size_;
366 AudioEncoderIsac::Config config; 366 AudioEncoderIsac::Config config;
367 config.payload_type = payload_type_; 367 config.payload_type = payload_type_;
368 config.sample_rate_hz = codec_input_rate_hz_; 368 config.sample_rate_hz = codec_input_rate_hz_;
369 config.adaptive_mode = false; 369 config.adaptive_mode = false;
370 config.frame_size_ms = 370 config.frame_size_ms =
371 1000 * static_cast<int>(frame_size_) / codec_input_rate_hz_; 371 1000 * static_cast<int>(frame_size_) / codec_input_rate_hz_;
372 audio_encoder_.reset(new AudioEncoderIsac(config)); 372 audio_encoder_.reset(new AudioEncoderIsac(config));
373 decoder_ = new AudioDecoderIsac(); 373 decoder_ = new AudioDecoderIsac(codec_input_rate_hz_);
374 } 374 }
375 }; 375 };
376 376
377 class AudioDecoderIsacSwbTest : public AudioDecoderTest { 377 class AudioDecoderIsacSwbTest : public AudioDecoderTest {
378 protected: 378 protected:
379 AudioDecoderIsacSwbTest() : AudioDecoderTest() { 379 AudioDecoderIsacSwbTest() : AudioDecoderTest() {
380 codec_input_rate_hz_ = 32000; 380 codec_input_rate_hz_ = 32000;
381 frame_size_ = 960; 381 frame_size_ = 960;
382 data_length_ = 10 * frame_size_; 382 data_length_ = 10 * frame_size_;
383 AudioEncoderIsac::Config config; 383 AudioEncoderIsac::Config config;
384 config.payload_type = payload_type_; 384 config.payload_type = payload_type_;
385 config.sample_rate_hz = codec_input_rate_hz_; 385 config.sample_rate_hz = codec_input_rate_hz_;
386 config.adaptive_mode = false; 386 config.adaptive_mode = false;
387 config.frame_size_ms = 387 config.frame_size_ms =
388 1000 * static_cast<int>(frame_size_) / codec_input_rate_hz_; 388 1000 * static_cast<int>(frame_size_) / codec_input_rate_hz_;
389 audio_encoder_.reset(new AudioEncoderIsac(config)); 389 audio_encoder_.reset(new AudioEncoderIsac(config));
390 decoder_ = new AudioDecoderIsac(); 390 decoder_ = new AudioDecoderIsac(codec_input_rate_hz_);
391 } 391 }
392 }; 392 };
393 393
394 class AudioDecoderIsacFixTest : public AudioDecoderTest { 394 class AudioDecoderIsacFixTest : public AudioDecoderTest {
395 protected: 395 protected:
396 AudioDecoderIsacFixTest() : AudioDecoderTest() { 396 AudioDecoderIsacFixTest() : AudioDecoderTest() {
397 codec_input_rate_hz_ = 16000; 397 codec_input_rate_hz_ = 16000;
398 frame_size_ = 480; 398 frame_size_ = 480;
399 data_length_ = 10 * frame_size_; 399 data_length_ = 10 * frame_size_;
400 AudioEncoderIsacFix::Config config; 400 AudioEncoderIsacFix::Config config;
401 config.payload_type = payload_type_; 401 config.payload_type = payload_type_;
402 config.sample_rate_hz = codec_input_rate_hz_; 402 config.sample_rate_hz = codec_input_rate_hz_;
403 config.adaptive_mode = false; 403 config.adaptive_mode = false;
404 config.frame_size_ms = 404 config.frame_size_ms =
405 1000 * static_cast<int>(frame_size_) / codec_input_rate_hz_; 405 1000 * static_cast<int>(frame_size_) / codec_input_rate_hz_;
406 audio_encoder_.reset(new AudioEncoderIsacFix(config)); 406 audio_encoder_.reset(new AudioEncoderIsacFix(config));
407 decoder_ = new AudioDecoderIsacFix(); 407 decoder_ = new AudioDecoderIsacFix(codec_input_rate_hz_);
408 } 408 }
409 }; 409 };
410 410
411 class AudioDecoderG722Test : public AudioDecoderTest { 411 class AudioDecoderG722Test : public AudioDecoderTest {
412 protected: 412 protected:
413 AudioDecoderG722Test() : AudioDecoderTest() { 413 AudioDecoderG722Test() : AudioDecoderTest() {
414 codec_input_rate_hz_ = 16000; 414 codec_input_rate_hz_ = 16000;
415 frame_size_ = 160; 415 frame_size_ = 160;
416 data_length_ = 10 * frame_size_; 416 data_length_ = 10 * frame_size_;
417 decoder_ = new AudioDecoderG722; 417 decoder_ = new AudioDecoderG722;
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGnb)); 738 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGnb));
739 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGwb)); 739 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGwb));
740 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb32kHz)); 740 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb32kHz));
741 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb48kHz)); 741 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb48kHz));
742 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderArbitrary)); 742 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderArbitrary));
743 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus)); 743 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus));
744 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus_2ch)); 744 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus_2ch));
745 } 745 }
746 746
747 } // namespace webrtc 747 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698