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

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

Issue 2930243003: Opus implementation of the AudioEncoderFactoryTemplate API (Closed)
Patch Set: rebase Created 3 years, 6 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_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 abca96852badad56f2922b705455d0566a19c7ab..4a7e291ed4a9949c07ba3ebb331a015c553df2de 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
@@ -10,6 +10,7 @@
#include "webrtc/api/audio_codecs/audio_encoder_factory_template.h"
#include "webrtc/api/audio_codecs/g722/audio_encoder_g722.h"
+#include "webrtc/api/audio_codecs/opus/audio_encoder_opus.h"
#include "webrtc/base/ptr_util.h"
#include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h"
@@ -133,4 +134,26 @@ TEST(AudioEncoderFactoryTemplateTest, G722) {
EXPECT_EQ(16000, enc->SampleRateHz());
}
+TEST(AudioEncoderFactoryTemplateTest, Opus) {
+ auto factory = CreateAudioEncoderFactory<AudioEncoderOpus>();
+ AudioCodecInfo info = {48000, 1, 32000, 6000, 510000};
+ info.allow_comfort_noise = false;
+ info.supports_network_adaption = true;
+ EXPECT_THAT(
+ factory->GetSupportedEncoders(),
+ testing::ElementsAre(AudioCodecSpec{
+ {"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}},
+ info}));
+ EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
+ factory->QueryAudioEncoder({"foo", 8000, 1}));
+ EXPECT_EQ(
+ rtc::Optional<AudioCodecInfo>(info),
+ factory->QueryAudioEncoder(
+ {"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}}));
+ EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 16000, 1}));
+ auto enc = factory->MakeAudioEncoder(17, {"opus", 48000, 2});
+ ASSERT_NE(nullptr, enc);
+ EXPECT_EQ(48000, enc->SampleRateHz());
+}
+
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698