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

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

Issue 2948483002: Opus implementation of the AudioEncoderFactoryTemplate API (Closed)
Patch Set: rebase Created 3 years, 5 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/opus/opus_complexity_unittest.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
11 #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h" 11 #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 #include <stdlib.h> 14 #include <stdlib.h>
15 15
16 #include <memory> 16 #include <memory>
17 #include <string> 17 #include <string>
18 #include <vector> 18 #include <vector>
19 19
20 #include "webrtc/api/audio_codecs/opus/audio_encoder_opus.h"
20 #include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h" 21 #include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h"
21 #include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h" 22 #include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h"
22 #include "webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h" 23 #include "webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h"
23 #include "webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h" 24 #include "webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h"
24 #include "webrtc/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h" 25 #include "webrtc/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h"
25 #include "webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h" 26 #include "webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h"
26 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_decoder_isac fix.h" 27 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_decoder_isac fix.h"
27 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isac fix.h" 28 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isac fix.h"
28 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isa c.h" 29 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isa c.h"
29 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isa c.h" 30 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isa c.h"
30 #include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h" 31 #include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h"
31 #include "webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h"
32 #include "webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.h" 32 #include "webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.h"
33 #include "webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h" 33 #include "webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h"
34 #include "webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.h" 34 #include "webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.h"
35 #include "webrtc/test/gtest.h" 35 #include "webrtc/test/gtest.h"
36 #include "webrtc/test/testsupport/fileutils.h" 36 #include "webrtc/test/testsupport/fileutils.h"
37 37
38 namespace webrtc { 38 namespace webrtc {
39 39
40 namespace { 40 namespace {
41 // The absolute difference between the input and output (the first channel) is 41 // The absolute difference between the input and output (the first channel) is
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 } 426 }
427 }; 427 };
428 428
429 class AudioDecoderOpusTest : public AudioDecoderTest { 429 class AudioDecoderOpusTest : public AudioDecoderTest {
430 protected: 430 protected:
431 AudioDecoderOpusTest() : AudioDecoderTest() { 431 AudioDecoderOpusTest() : AudioDecoderTest() {
432 codec_input_rate_hz_ = 48000; 432 codec_input_rate_hz_ = 48000;
433 frame_size_ = 480; 433 frame_size_ = 480;
434 data_length_ = 10 * frame_size_; 434 data_length_ = 10 * frame_size_;
435 decoder_ = new AudioDecoderOpus(1); 435 decoder_ = new AudioDecoderOpus(1);
436 AudioEncoderOpus::Config config; 436 AudioEncoderOpusConfig config;
437 config.frame_size_ms = static_cast<int>(frame_size_) / 48; 437 config.frame_size_ms = static_cast<int>(frame_size_) / 48;
438 config.payload_type = payload_type_; 438 config.application = AudioEncoderOpusConfig::ApplicationMode::kVoip;
439 config.application = AudioEncoderOpus::kVoip; 439 audio_encoder_ = AudioEncoderOpus::MakeAudioEncoder(config, payload_type_);
440 audio_encoder_.reset(new AudioEncoderOpus(config));
441 } 440 }
442 }; 441 };
443 442
444 class AudioDecoderOpusStereoTest : public AudioDecoderOpusTest { 443 class AudioDecoderOpusStereoTest : public AudioDecoderOpusTest {
445 protected: 444 protected:
446 AudioDecoderOpusStereoTest() : AudioDecoderOpusTest() { 445 AudioDecoderOpusStereoTest() : AudioDecoderOpusTest() {
447 channels_ = 2; 446 channels_ = 2;
448 delete decoder_; 447 delete decoder_;
449 decoder_ = new AudioDecoderOpus(2); 448 decoder_ = new AudioDecoderOpus(2);
450 AudioEncoderOpus::Config config; 449 AudioEncoderOpusConfig config;
451 config.frame_size_ms = static_cast<int>(frame_size_) / 48; 450 config.frame_size_ms = static_cast<int>(frame_size_) / 48;
452 config.num_channels = 2; 451 config.num_channels = 2;
453 config.payload_type = payload_type_; 452 config.application = AudioEncoderOpusConfig::ApplicationMode::kAudio;
454 config.application = AudioEncoderOpus::kAudio; 453 audio_encoder_ = AudioEncoderOpus::MakeAudioEncoder(config, payload_type_);
455 audio_encoder_.reset(new AudioEncoderOpus(config));
456 } 454 }
457 }; 455 };
458 456
459 TEST_F(AudioDecoderPcmUTest, EncodeDecode) { 457 TEST_F(AudioDecoderPcmUTest, EncodeDecode) {
460 int tolerance = 251; 458 int tolerance = 251;
461 double mse = 1734.0; 459 double mse = 1734.0;
462 EncodeDecodeTest(data_length_, tolerance, mse); 460 EncodeDecodeTest(data_length_, tolerance, mse);
463 ReInitTest(); 461 ReInitTest();
464 EXPECT_FALSE(decoder_->HasDecodePlc()); 462 EXPECT_FALSE(decoder_->HasDecodePlc());
465 } 463 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGnb)); 684 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGnb));
687 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGwb)); 685 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGwb));
688 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb32kHz)); 686 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb32kHz));
689 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb48kHz)); 687 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb48kHz));
690 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderArbitrary)); 688 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderArbitrary));
691 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus)); 689 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus));
692 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus_2ch)); 690 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus_2ch));
693 } 691 }
694 692
695 } // namespace webrtc 693 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/opus/opus_complexity_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698