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 |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 #else | 667 #else |
668 const bool has_g722 = false; | 668 const bool has_g722 = false; |
669 #endif | 669 #endif |
670 #ifdef WEBRTC_CODEC_OPUS | 670 #ifdef WEBRTC_CODEC_OPUS |
671 const bool has_opus = true; | 671 const bool has_opus = true; |
672 #else | 672 #else |
673 const bool has_opus = false; | 673 const bool has_opus = false; |
674 #endif | 674 #endif |
675 } // namespace | 675 } // namespace |
676 | 676 |
677 TEST(AudioDecoder, CodecSampleRateHz) { | |
678 EXPECT_EQ(8000, CodecSampleRateHz(NetEqDecoder::kDecoderPCMu)); | |
679 EXPECT_EQ(8000, CodecSampleRateHz(NetEqDecoder::kDecoderPCMa)); | |
680 EXPECT_EQ(8000, CodecSampleRateHz(NetEqDecoder::kDecoderPCMu_2ch)); | |
681 EXPECT_EQ(8000, CodecSampleRateHz(NetEqDecoder::kDecoderPCMa_2ch)); | |
682 EXPECT_EQ(has_ilbc ? 8000 : -1, | |
683 CodecSampleRateHz(NetEqDecoder::kDecoderILBC)); | |
684 EXPECT_EQ(has_isac ? 16000 : -1, | |
685 CodecSampleRateHz(NetEqDecoder::kDecoderISAC)); | |
686 EXPECT_EQ(has_isac_swb ? 32000 : -1, | |
687 CodecSampleRateHz(NetEqDecoder::kDecoderISACswb)); | |
688 EXPECT_EQ(8000, CodecSampleRateHz(NetEqDecoder::kDecoderPCM16B)); | |
689 EXPECT_EQ(16000, CodecSampleRateHz(NetEqDecoder::kDecoderPCM16Bwb)); | |
690 EXPECT_EQ(32000, CodecSampleRateHz(NetEqDecoder::kDecoderPCM16Bswb32kHz)); | |
691 EXPECT_EQ(48000, CodecSampleRateHz(NetEqDecoder::kDecoderPCM16Bswb48kHz)); | |
692 EXPECT_EQ(8000, CodecSampleRateHz(NetEqDecoder::kDecoderPCM16B_2ch)); | |
693 EXPECT_EQ(16000, CodecSampleRateHz(NetEqDecoder::kDecoderPCM16Bwb_2ch)); | |
694 EXPECT_EQ(32000, CodecSampleRateHz(NetEqDecoder::kDecoderPCM16Bswb32kHz_2ch)); | |
695 EXPECT_EQ(48000, CodecSampleRateHz(NetEqDecoder::kDecoderPCM16Bswb48kHz_2ch)); | |
696 EXPECT_EQ(8000, CodecSampleRateHz(NetEqDecoder::kDecoderPCM16B_5ch)); | |
697 EXPECT_EQ(has_g722 ? 16000 : -1, | |
698 CodecSampleRateHz(NetEqDecoder::kDecoderG722)); | |
699 EXPECT_EQ(has_g722 ? 16000 : -1, | |
700 CodecSampleRateHz(NetEqDecoder::kDecoderG722_2ch)); | |
701 EXPECT_EQ(-1, CodecSampleRateHz(NetEqDecoder::kDecoderRED)); | |
702 EXPECT_EQ(-1, CodecSampleRateHz(NetEqDecoder::kDecoderAVT)); | |
703 EXPECT_EQ(8000, CodecSampleRateHz(NetEqDecoder::kDecoderCNGnb)); | |
704 EXPECT_EQ(16000, CodecSampleRateHz(NetEqDecoder::kDecoderCNGwb)); | |
705 EXPECT_EQ(32000, CodecSampleRateHz(NetEqDecoder::kDecoderCNGswb32kHz)); | |
706 EXPECT_EQ(has_opus ? 48000 : -1, | |
707 CodecSampleRateHz(NetEqDecoder::kDecoderOpus)); | |
708 EXPECT_EQ(has_opus ? 48000 : -1, | |
709 CodecSampleRateHz(NetEqDecoder::kDecoderOpus_2ch)); | |
710 EXPECT_EQ(48000, CodecSampleRateHz(NetEqDecoder::kDecoderOpus)); | |
711 EXPECT_EQ(48000, CodecSampleRateHz(NetEqDecoder::kDecoderOpus_2ch)); | |
712 // TODO(tlegrand): Change 32000 to 48000 below once ACM has 48 kHz support. | |
713 EXPECT_EQ(32000, CodecSampleRateHz(NetEqDecoder::kDecoderCNGswb48kHz)); | |
714 EXPECT_EQ(-1, CodecSampleRateHz(NetEqDecoder::kDecoderArbitrary)); | |
715 } | |
716 | |
717 TEST(AudioDecoder, CodecSupported) { | 677 TEST(AudioDecoder, CodecSupported) { |
718 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderPCMu)); | 678 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderPCMu)); |
719 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderPCMa)); | 679 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderPCMa)); |
720 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderPCMu_2ch)); | 680 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderPCMu_2ch)); |
721 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderPCMa_2ch)); | 681 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderPCMa_2ch)); |
722 EXPECT_EQ(has_ilbc, CodecSupported(NetEqDecoder::kDecoderILBC)); | 682 EXPECT_EQ(has_ilbc, CodecSupported(NetEqDecoder::kDecoderILBC)); |
723 EXPECT_EQ(has_isac, CodecSupported(NetEqDecoder::kDecoderISAC)); | 683 EXPECT_EQ(has_isac, CodecSupported(NetEqDecoder::kDecoderISAC)); |
724 EXPECT_EQ(has_isac_swb, CodecSupported(NetEqDecoder::kDecoderISACswb)); | 684 EXPECT_EQ(has_isac_swb, CodecSupported(NetEqDecoder::kDecoderISACswb)); |
725 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderPCM16B)); | 685 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderPCM16B)); |
726 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderPCM16Bwb)); | 686 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderPCM16Bwb)); |
(...skipping 11 matching lines...) Expand all Loading... |
738 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGnb)); | 698 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGnb)); |
739 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGwb)); | 699 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGwb)); |
740 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb32kHz)); | 700 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb32kHz)); |
741 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb48kHz)); | 701 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderCNGswb48kHz)); |
742 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderArbitrary)); | 702 EXPECT_TRUE(CodecSupported(NetEqDecoder::kDecoderArbitrary)); |
743 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus)); | 703 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus)); |
744 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus_2ch)); | 704 EXPECT_EQ(has_opus, CodecSupported(NetEqDecoder::kDecoderOpus_2ch)); |
745 } | 705 } |
746 | 706 |
747 } // namespace webrtc | 707 } // namespace webrtc |
OLD | NEW |