Index: webrtc/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc |
diff --git a/webrtc/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc b/webrtc/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc |
index 15097b9318e125b48a55d13261b11896f7fb5ea2..abca96852badad56f2922b705455d0566a19c7ab 100644 |
--- a/webrtc/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc |
+++ b/webrtc/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc |
@@ -9,6 +9,7 @@ |
*/ |
#include "webrtc/api/audio_codecs/audio_encoder_factory_template.h" |
+#include "webrtc/api/audio_codecs/g722/audio_encoder_g722.h" |
#include "webrtc/base/ptr_util.h" |
#include "webrtc/test/gmock.h" |
#include "webrtc/test/gtest.h" |
@@ -117,4 +118,19 @@ TEST(AudioEncoderFactoryTemplateTest, TwoEncoderTypes) { |
EXPECT_EQ(16000, enc2->SampleRateHz()); |
} |
+TEST(AudioEncoderFactoryTemplateTest, G722) { |
+ auto factory = CreateAudioEncoderFactory<AudioEncoderG722>(); |
+ EXPECT_THAT(factory->GetSupportedEncoders(), |
+ testing::ElementsAre( |
+ AudioCodecSpec{{"g722", 8000, 1}, {16000, 1, 64000}})); |
+ EXPECT_EQ(rtc::Optional<AudioCodecInfo>(), |
+ factory->QueryAudioEncoder({"foo", 8000, 1})); |
+ EXPECT_EQ(rtc::Optional<AudioCodecInfo>({16000, 1, 64000}), |
+ factory->QueryAudioEncoder({"g722", 8000, 1})); |
+ EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 16000, 1})); |
+ auto enc = factory->MakeAudioEncoder(17, {"g722", 8000, 1}); |
+ ASSERT_NE(nullptr, enc); |
+ EXPECT_EQ(16000, enc->SampleRateHz()); |
+} |
+ |
} // namespace webrtc |