| Index: webrtc/media/engine/webrtcvoiceengine_unittest.cc
|
| diff --git a/webrtc/media/engine/webrtcvoiceengine_unittest.cc b/webrtc/media/engine/webrtcvoiceengine_unittest.cc
|
| index 98a9101811fa7b90bbda8acbe4e24e06ac673ae3..5f3288c3b7622b4cb62316724a57ed1b5bded99a 100644
|
| --- a/webrtc/media/engine/webrtcvoiceengine_unittest.cc
|
| +++ b/webrtc/media/engine/webrtcvoiceengine_unittest.cc
|
| @@ -14,8 +14,10 @@
|
| #include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h"
|
| #include "webrtc/base/arraysize.h"
|
| #include "webrtc/base/byteorder.h"
|
| +#include "webrtc/base/ptr_util.h"
|
| #include "webrtc/base/safe_conversions.h"
|
| #include "webrtc/call/call.h"
|
| +#include "webrtc/call/rtp_transport_controller_send.h"
|
| #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
|
| #include "webrtc/media/base/fakemediaengine.h"
|
| #include "webrtc/media/base/fakenetworkinterface.h"
|
| @@ -115,6 +117,29 @@ void AdmSetupExpectations(webrtc::test::MockAudioDeviceModule* adm) {
|
| EXPECT_CALL(*adm, BuiltInNSIsAvailable()).WillOnce(Return(false));
|
| EXPECT_CALL(*adm, SetAGC(true)).WillOnce(Return(0));
|
| }
|
| +
|
| +// Helper class to construct and own Call and the RtcEventLog and
|
| +// RtpTransportControllerSend it depends on.
|
| +class CallHelper {
|
| + public:
|
| + CallHelper()
|
| + : rtp_transport_controller_send_(
|
| + rtc::MakeUnique<webrtc::RtpTransportControllerSend>(
|
| + webrtc::Clock::GetRealTimeClock(), &event_log_)) {
|
| + webrtc::Call::Config call_config(&event_log_);
|
| + call_config.audio_rtp_transport_send = rtp_transport_controller_send_.get();
|
| + call_config.video_rtp_transport_send = rtp_transport_controller_send_.get();
|
| + call_config.send_side_cc = rtp_transport_controller_send_->send_side_cc();
|
| + call_ = rtc::WrapUnique(webrtc::Call::Create(call_config));
|
| + }
|
| + webrtc::Call* call() { return call_.get(); }
|
| + private:
|
| + webrtc::RtcEventLogNullImpl event_log_;
|
| + const std::unique_ptr<webrtc::RtpTransportControllerSendInterface>
|
| + rtp_transport_controller_send_;
|
| + std::unique_ptr<webrtc::Call> call_;
|
| +};
|
| +
|
| } // namespace
|
|
|
| // Tests that our stub library "works".
|
| @@ -3263,11 +3288,9 @@ TEST(WebRtcVoiceEngineTest, StartupShutdown) {
|
| cricket::WebRtcVoiceEngine engine(
|
| nullptr, webrtc::MockAudioEncoderFactory::CreateUnusedFactory(),
|
| webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr);
|
| - webrtc::RtcEventLogNullImpl event_log;
|
| - std::unique_ptr<webrtc::Call> call(
|
| - webrtc::Call::Create(webrtc::Call::Config(&event_log)));
|
| + CallHelper call_helper;
|
| cricket::VoiceMediaChannel* channel = engine.CreateChannel(
|
| - call.get(), cricket::MediaConfig(), cricket::AudioOptions());
|
| + call_helper.call(), cricket::MediaConfig(), cricket::AudioOptions());
|
| EXPECT_TRUE(channel != nullptr);
|
| delete channel;
|
| }
|
| @@ -3284,11 +3307,9 @@ TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternalADM) {
|
| cricket::WebRtcVoiceEngine engine(
|
| &adm, webrtc::MockAudioEncoderFactory::CreateUnusedFactory(),
|
| webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr);
|
| - webrtc::RtcEventLogNullImpl event_log;
|
| - std::unique_ptr<webrtc::Call> call(
|
| - webrtc::Call::Create(webrtc::Call::Config(&event_log)));
|
| + CallHelper call_helper;
|
| cricket::VoiceMediaChannel* channel = engine.CreateChannel(
|
| - call.get(), cricket::MediaConfig(), cricket::AudioOptions());
|
| + call_helper.call(), cricket::MediaConfig(), cricket::AudioOptions());
|
| EXPECT_TRUE(channel != nullptr);
|
| delete channel;
|
| }
|
| @@ -3342,15 +3363,13 @@ TEST(WebRtcVoiceEngineTest, Has32Channels) {
|
| cricket::WebRtcVoiceEngine engine(
|
| nullptr, webrtc::MockAudioEncoderFactory::CreateUnusedFactory(),
|
| webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr);
|
| - webrtc::RtcEventLogNullImpl event_log;
|
| - std::unique_ptr<webrtc::Call> call(
|
| - webrtc::Call::Create(webrtc::Call::Config(&event_log)));
|
| + CallHelper call_helper;
|
|
|
| cricket::VoiceMediaChannel* channels[32];
|
| int num_channels = 0;
|
| while (num_channels < arraysize(channels)) {
|
| cricket::VoiceMediaChannel* channel = engine.CreateChannel(
|
| - call.get(), cricket::MediaConfig(), cricket::AudioOptions());
|
| + call_helper.call(), cricket::MediaConfig(), cricket::AudioOptions());
|
| if (!channel)
|
| break;
|
| channels[num_channels++] = channel;
|
| @@ -3376,11 +3395,10 @@ TEST(WebRtcVoiceEngineTest, SetRecvCodecs) {
|
| cricket::WebRtcVoiceEngine engine(
|
| nullptr, webrtc::MockAudioEncoderFactory::CreateUnusedFactory(),
|
| webrtc::CreateBuiltinAudioDecoderFactory(), nullptr);
|
| - webrtc::RtcEventLogNullImpl event_log;
|
| - std::unique_ptr<webrtc::Call> call(
|
| - webrtc::Call::Create(webrtc::Call::Config(&event_log)));
|
| + CallHelper call_helper;
|
| cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
|
| - cricket::AudioOptions(), call.get());
|
| + cricket::AudioOptions(),
|
| + call_helper.call());
|
| cricket::AudioRecvParameters parameters;
|
| parameters.codecs = engine.recv_codecs();
|
| EXPECT_TRUE(channel.SetRecvParameters(parameters));
|
|
|