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

Unified Diff: webrtc/media/engine/webrtcvoiceengine_unittest.cc

Issue 1949533002: WIP: Move the creation of AudioCodecFactory into PeerConnectionFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Retained Channel API by adding overloads; also add intended AudioReceiveStream API Created 4 years, 7 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/media/engine/webrtcvoiceengine_unittest.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine_unittest.cc b/webrtc/media/engine/webrtcvoiceengine_unittest.cc
index c72775a98504fc7102a9fd920ab47c87faa0d346..2118c694b81265a31971e4b1b57666611abf6e2e 100644
--- a/webrtc/media/engine/webrtcvoiceengine_unittest.cc
+++ b/webrtc/media/engine/webrtcvoiceengine_unittest.cc
@@ -24,6 +24,7 @@
#include "webrtc/media/engine/fakewebrtccall.h"
#include "webrtc/media/engine/fakewebrtcvoiceengine.h"
#include "webrtc/media/engine/webrtcvoiceengine.h"
+#include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h"
#include "webrtc/modules/audio_device/include/mock_audio_device.h"
using cricket::kRtpAudioLevelHeaderExtension;
@@ -75,7 +76,10 @@ TEST(WebRtcVoiceEngineTestStubLibrary, StartupShutdown) {
cricket::FakeWebRtcVoiceEngine voe;
EXPECT_FALSE(voe.IsInited());
{
- cricket::WebRtcVoiceEngine engine(&adm, new FakeVoEWrapper(&voe));
+ cricket::WebRtcVoiceEngine engine(
+ &adm,
+ std::shared_ptr<webrtc::AudioDecoderFactory>(),
+ new FakeVoEWrapper(&voe));
EXPECT_TRUE(voe.IsInited());
}
EXPECT_FALSE(voe.IsInited());
@@ -101,8 +105,10 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
EXPECT_CALL(adm_, BuiltInAECIsAvailable()).WillOnce(Return(false));
EXPECT_CALL(adm_, BuiltInAGCIsAvailable()).WillOnce(Return(false));
EXPECT_CALL(adm_, BuiltInNSIsAvailable()).WillOnce(Return(false));
- engine_.reset(new cricket::WebRtcVoiceEngine(&adm_,
- new FakeVoEWrapper(&voe_)));
+ engine_.reset(new cricket::WebRtcVoiceEngine(
+ &adm_,
+ std::shared_ptr<webrtc::AudioDecoderFactory>(),
+ new FakeVoEWrapper(&voe_)));
send_parameters_.codecs.push_back(kPcmuCodec);
recv_parameters_.codecs.push_back(kPcmuCodec);
}
@@ -3459,7 +3465,10 @@ TEST_F(WebRtcVoiceEngineTestFake, OnReadyToSendSignalsNetworkState) {
// Tests that the library initializes and shuts down properly.
TEST(WebRtcVoiceEngineTest, StartupShutdown) {
- cricket::WebRtcVoiceEngine engine(nullptr);
+ // TODO(ossu): Should probably use a mock audio decoder factory.
kwiberg-webrtc 2016/05/17 13:33:48 Your heart's in the right place!
+ cricket::WebRtcVoiceEngine engine(
+ nullptr,
+ std::shared_ptr<webrtc::AudioDecoderFactory>());
kwiberg-webrtc 2016/05/17 13:33:48 nullptr
ossu 2016/05/17 14:25:35 Yeah, I realized that after a while. I've actually
std::unique_ptr<webrtc::Call> call(
webrtc::Call::Create(webrtc::Call::Config()));
cricket::VoiceMediaChannel* channel = engine.CreateChannel(
@@ -3474,7 +3483,9 @@ TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternalADM) {
EXPECT_CALL(adm, AddRef()).Times(3).WillRepeatedly(Return(0));
EXPECT_CALL(adm, Release()).Times(3).WillRepeatedly(Return(0));
{
- cricket::WebRtcVoiceEngine engine(&adm);
+ cricket::WebRtcVoiceEngine engine(
+ &adm,
+ std::shared_ptr<webrtc::AudioDecoderFactory>());
kwiberg-webrtc 2016/05/17 13:33:48 nullptr
std::unique_ptr<webrtc::Call> call(
webrtc::Call::Create(webrtc::Call::Config()));
cricket::VoiceMediaChannel* channel = engine.CreateChannel(
@@ -3486,6 +3497,9 @@ TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternalADM) {
// Tests that the library is configured with the codecs we want.
TEST(WebRtcVoiceEngineTest, HasCorrectCodecs) {
+ // TODO(ossu): These tests should move into a future "builtin audio codecs"
+ // module.
+
// Check codecs by name.
EXPECT_TRUE(cricket::WebRtcVoiceEngine::ToCodecInst(
cricket::AudioCodec(96, "OPUS", 48000, 0, 2), nullptr));
@@ -3539,7 +3553,8 @@ TEST(WebRtcVoiceEngineTest, HasCorrectCodecs) {
cricket::AudioCodec(0, "", 0, 5000, 1), nullptr));
// Verify the payload id of common audio codecs, including CN, ISAC, and G722.
- cricket::WebRtcVoiceEngine engine(nullptr);
+ cricket::WebRtcVoiceEngine engine(nullptr,
+ webrtc::CreateBuiltinAudioDecoderFactory());
for (std::vector<cricket::AudioCodec>::const_iterator it =
engine.codecs().begin(); it != engine.codecs().end(); ++it) {
if (it->name == "CN" && it->clockrate == 16000) {
@@ -3570,7 +3585,9 @@ TEST(WebRtcVoiceEngineTest, HasCorrectCodecs) {
// Tests that VoE supports at least 32 channels
TEST(WebRtcVoiceEngineTest, Has32Channels) {
- cricket::WebRtcVoiceEngine engine(nullptr);
+ cricket::WebRtcVoiceEngine engine(
+ nullptr,
+ std::shared_ptr<webrtc::AudioDecoderFactory>());
kwiberg-webrtc 2016/05/17 13:33:48 nullptr
std::unique_ptr<webrtc::Call> call(
webrtc::Call::Create(webrtc::Call::Config()));
@@ -3594,7 +3611,9 @@ TEST(WebRtcVoiceEngineTest, Has32Channels) {
// Test that we set our preferred codecs properly.
TEST(WebRtcVoiceEngineTest, SetRecvCodecs) {
- cricket::WebRtcVoiceEngine engine(nullptr);
+ // TODO(ossu): Should probably use a mock audio decoder factory.
+ cricket::WebRtcVoiceEngine engine(nullptr,
+ webrtc::CreateBuiltinAudioDecoderFactory());
std::unique_ptr<webrtc::Call> call(
webrtc::Call::Create(webrtc::Call::Config()));
cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),

Powered by Google App Engine
This is Rietveld 408576698