OLD | NEW |
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" | |
21 #include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h" | 20 #include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h" |
22 #include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h" | 21 #include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h" |
23 #include "webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h" | 22 #include "webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h" |
24 #include "webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h" | 23 #include "webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h" |
25 #include "webrtc/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h" | 24 #include "webrtc/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h" |
26 #include "webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h" | 25 #include "webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h" |
27 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_decoder_isac
fix.h" | 26 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_decoder_isac
fix.h" |
28 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isac
fix.h" | 27 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isac
fix.h" |
29 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isa
c.h" | 28 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isa
c.h" |
30 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isa
c.h" | 29 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isa
c.h" |
31 #include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h" | 30 #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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } | 427 } |
428 }; | 428 }; |
429 | 429 |
430 class AudioDecoderOpusTest : public AudioDecoderTest { | 430 class AudioDecoderOpusTest : public AudioDecoderTest { |
431 protected: | 431 protected: |
432 AudioDecoderOpusTest() : AudioDecoderTest() { | 432 AudioDecoderOpusTest() : AudioDecoderTest() { |
433 codec_input_rate_hz_ = 48000; | 433 codec_input_rate_hz_ = 48000; |
434 frame_size_ = 480; | 434 frame_size_ = 480; |
435 data_length_ = 10 * frame_size_; | 435 data_length_ = 10 * frame_size_; |
436 decoder_ = new AudioDecoderOpus(1); | 436 decoder_ = new AudioDecoderOpus(1); |
437 AudioEncoderOpusConfig config; | 437 AudioEncoderOpus::Config config; |
438 config.frame_size_ms = static_cast<int>(frame_size_) / 48; | 438 config.frame_size_ms = static_cast<int>(frame_size_) / 48; |
439 config.application = AudioEncoderOpusConfig::ApplicationMode::kVoip; | 439 config.payload_type = payload_type_; |
440 audio_encoder_ = AudioEncoderOpus::MakeAudioEncoder(config, payload_type_); | 440 config.application = AudioEncoderOpus::kVoip; |
| 441 audio_encoder_.reset(new AudioEncoderOpus(config)); |
441 } | 442 } |
442 }; | 443 }; |
443 | 444 |
444 class AudioDecoderOpusStereoTest : public AudioDecoderOpusTest { | 445 class AudioDecoderOpusStereoTest : public AudioDecoderOpusTest { |
445 protected: | 446 protected: |
446 AudioDecoderOpusStereoTest() : AudioDecoderOpusTest() { | 447 AudioDecoderOpusStereoTest() : AudioDecoderOpusTest() { |
447 channels_ = 2; | 448 channels_ = 2; |
448 delete decoder_; | 449 delete decoder_; |
449 decoder_ = new AudioDecoderOpus(2); | 450 decoder_ = new AudioDecoderOpus(2); |
450 AudioEncoderOpusConfig config; | 451 AudioEncoderOpus::Config config; |
451 config.frame_size_ms = static_cast<int>(frame_size_) / 48; | 452 config.frame_size_ms = static_cast<int>(frame_size_) / 48; |
452 config.num_channels = 2; | 453 config.num_channels = 2; |
453 config.application = AudioEncoderOpusConfig::ApplicationMode::kAudio; | 454 config.payload_type = payload_type_; |
454 audio_encoder_ = AudioEncoderOpus::MakeAudioEncoder(config, payload_type_); | 455 config.application = AudioEncoderOpus::kAudio; |
| 456 audio_encoder_.reset(new AudioEncoderOpus(config)); |
455 } | 457 } |
456 }; | 458 }; |
457 | 459 |
458 TEST_F(AudioDecoderPcmUTest, EncodeDecode) { | 460 TEST_F(AudioDecoderPcmUTest, EncodeDecode) { |
459 int tolerance = 251; | 461 int tolerance = 251; |
460 double mse = 1734.0; | 462 double mse = 1734.0; |
461 EncodeDecodeTest(data_length_, tolerance, mse); | 463 EncodeDecodeTest(data_length_, tolerance, mse); |
462 ReInitTest(); | 464 ReInitTest(); |
463 EXPECT_FALSE(decoder_->HasDecodePlc()); | 465 EXPECT_FALSE(decoder_->HasDecodePlc()); |
464 } | 466 } |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGnb)); | 687 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGnb)); |
686 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGwb)); | 688 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGwb)); |
687 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb32kHz)); | 689 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb32kHz)); |
688 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb48kHz)); | 690 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb48kHz)); |
689 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderArbitrary)); | 691 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderArbitrary)); |
690 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus)); | 692 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus)); |
691 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus_2ch)); | 693 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus_2ch)); |
692 } | 694 } |
693 | 695 |
694 } // namespace webrtc | 696 } // namespace webrtc |
OLD | NEW |