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

Unified Diff: webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc

Issue 2962653002: G711 implementation of the Audio{En,De}coderFactoryTemplate APIs (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 side-by-side diff with in-line comments
Download patch
Index: webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc
diff --git a/webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc b/webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc
index 9b2747cd614c7b0ccd6538a3f73a8a16f4372398..ee754d4a9b6ee9958bc35ed48b95cb132a2ac927 100644
--- a/webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc
+++ b/webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc
@@ -9,6 +9,7 @@
*/
#include "webrtc/api/audio_codecs/audio_decoder_factory_template.h"
+#include "webrtc/api/audio_codecs/g711/audio_decoder_g711.h"
#include "webrtc/api/audio_codecs/g722/audio_decoder_g722.h"
#include "webrtc/api/audio_codecs/ilbc/audio_decoder_ilbc.h"
#include "webrtc/api/audio_codecs/opus/audio_decoder_opus.h"
@@ -113,6 +114,24 @@ TEST(AudioDecoderFactoryTemplateTest, TwoDecoderTypes) {
EXPECT_EQ(16000, dec2->SampleRateHz());
}
+TEST(AudioDecoderFactoryTemplateTest, G711) {
+ auto factory = CreateAudioDecoderFactory<AudioDecoderG711>();
+ EXPECT_THAT(factory->GetSupportedDecoders(),
+ testing::ElementsAre(
+ AudioCodecSpec{{"PCMU", 8000, 1}, {8000, 1, 64000}},
+ AudioCodecSpec{{"PCMA", 8000, 1}, {8000, 1, 64000}}));
+ EXPECT_FALSE(factory->IsSupportedDecoder({"g711", 8000, 1}));
+ EXPECT_TRUE(factory->IsSupportedDecoder({"PCMU", 8000, 1}));
+ EXPECT_TRUE(factory->IsSupportedDecoder({"pcma", 8000, 1}));
+ EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"pcmu", 16000, 1}));
+ auto dec1 = factory->MakeAudioDecoder({"pcmu", 8000, 1});
+ ASSERT_NE(nullptr, dec1);
+ EXPECT_EQ(8000, dec1->SampleRateHz());
+ auto dec2 = factory->MakeAudioDecoder({"PCMA", 8000, 1});
+ ASSERT_NE(nullptr, dec2);
+ EXPECT_EQ(8000, dec2->SampleRateHz());
+}
+
TEST(AudioDecoderFactoryTemplateTest, G722) {
auto factory = CreateAudioDecoderFactory<AudioDecoderG722>();
EXPECT_THAT(factory->GetSupportedDecoders(),
« no previous file with comments | « webrtc/api/audio_codecs/test/BUILD.gn ('k') | webrtc/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698