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

Unified Diff: webrtc/api/audio_codecs/test/audio_encoder_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
« no previous file with comments | « webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 db477fd00c60cbd95bc7cd492548d3870e2116f7..58ab28ea41b466d62bee8c694bb912126c1d91cb 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/g711/audio_encoder_g711.h"
#include "webrtc/api/audio_codecs/g722/audio_encoder_g722.h"
#include "webrtc/api/audio_codecs/ilbc/audio_encoder_ilbc.h"
#include "webrtc/api/audio_codecs/opus/audio_encoder_opus.h"
@@ -120,6 +121,25 @@ TEST(AudioEncoderFactoryTemplateTest, TwoEncoderTypes) {
EXPECT_EQ(16000, enc2->SampleRateHz());
}
+TEST(AudioEncoderFactoryTemplateTest, G711) {
+ auto factory = CreateAudioEncoderFactory<AudioEncoderG711>();
+ EXPECT_THAT(factory->GetSupportedEncoders(),
+ testing::ElementsAre(
+ AudioCodecSpec{{"PCMU", 8000, 1}, {8000, 1, 64000}},
+ AudioCodecSpec{{"PCMA", 8000, 1}, {8000, 1, 64000}}));
+ EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
+ factory->QueryAudioEncoder({"PCMA", 16000, 1}));
+ EXPECT_EQ(rtc::Optional<AudioCodecInfo>({8000, 1, 64000}),
+ factory->QueryAudioEncoder({"PCMA", 8000, 1}));
+ EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"PCMU", 16000, 1}));
+ auto enc1 = factory->MakeAudioEncoder(17, {"PCMU", 8000, 1});
+ ASSERT_NE(nullptr, enc1);
+ EXPECT_EQ(8000, enc1->SampleRateHz());
+ auto enc2 = factory->MakeAudioEncoder(17, {"PCMA", 8000, 1});
+ ASSERT_NE(nullptr, enc2);
+ EXPECT_EQ(8000, enc2->SampleRateHz());
+}
+
TEST(AudioEncoderFactoryTemplateTest, G722) {
auto factory = CreateAudioEncoderFactory<AudioEncoderG722>();
EXPECT_THAT(factory->GetSupportedEncoders(),
« no previous file with comments | « webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698