Remove unnecessary audio references in PeerConnectionFactory

We currently pass in a lot of audio parameters to PeerConnectionFactory
which we never use. This CL removes them.

All these parameters are reference counted, so they are not needed for
lifetime management (unless we do something crazy). Even if we want to
switch from reference counting to std::unique_ptrs in the future, the
voice engine is a more suitable owner than PeerConnectionFactory. The
PeerConnectionFactory already owns a MediaEngine which in turn owns a
VoiceEngine.

Bug: webrtc:7613
Change-Id: I393cf0d29ffa762a3a13475f6fbe00b8565f4c07
Reviewed-on: https://webrtc-review.googlesource.com/1600
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19931}
This commit is contained in:
Magnus Jedvert
2017-09-23 16:14:25 +02:00
committed by Commit Bot
parent 73c81759cb
commit 835cc0c646
8 changed files with 11 additions and 62 deletions

View File

@ -1229,12 +1229,8 @@ CreateModularPeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
std::unique_ptr<cricket::MediaEngineInterface> media_engine,
std::unique_ptr<CallFactoryInterface> call_factory,
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory);

View File

@ -71,10 +71,9 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
CreateRtcEventLogFactory();
return CreateModularPeerConnectionFactory(
network_thread, worker_thread, signaling_thread, default_adm,
audio_encoder_factory, audio_decoder_factory, video_encoder_factory,
video_decoder_factory, audio_mixer, std::move(media_engine),
std::move(call_factory), std::move(event_log_factory));
network_thread, worker_thread, signaling_thread, video_encoder_factory,
video_decoder_factory, std::move(media_engine), std::move(call_factory),
std::move(event_log_factory));
}
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
@ -103,12 +102,10 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
CreateRtcEventLogFactory();
return CreateModularPeerConnectionFactory(
network_thread, worker_thread, signaling_thread, default_adm,
audio_encoder_factory, audio_decoder_factory,
network_thread, worker_thread, signaling_thread,
nullptr /* external_video_encoder_factory */,
nullptr /* external_video_decoder_factory */, audio_mixer,
std::move(media_engine), std::move(call_factory),
std::move(event_log_factory));
nullptr /* external_video_decoder_factory */, std::move(media_engine),
std::move(call_factory), std::move(event_log_factory));
}
rtc::scoped_refptr<PeerConnectionFactoryInterface>

View File

@ -46,20 +46,15 @@ CreateModularPeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
std::unique_ptr<cricket::MediaEngineInterface> media_engine,
std::unique_ptr<CallFactoryInterface> call_factory,
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory) {
rtc::scoped_refptr<PeerConnectionFactory> pc_factory(
new rtc::RefCountedObject<PeerConnectionFactory>(
network_thread, worker_thread, signaling_thread, default_adm,
audio_encoder_factory, audio_decoder_factory, video_encoder_factory,
video_decoder_factory, audio_mixer, std::move(media_engine),
network_thread, worker_thread, signaling_thread,
video_encoder_factory, video_decoder_factory, std::move(media_engine),
std::move(call_factory), std::move(event_log_factory)));
// Call Initialize synchronously but make sure it is executed on
@ -79,12 +74,8 @@ PeerConnectionFactory::PeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
std::unique_ptr<cricket::MediaEngineInterface> media_engine,
std::unique_ptr<webrtc::CallFactoryInterface> call_factory,
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory)
@ -92,12 +83,8 @@ PeerConnectionFactory::PeerConnectionFactory(
network_thread_(network_thread),
worker_thread_(worker_thread),
signaling_thread_(signaling_thread),
default_adm_(default_adm),
audio_encoder_factory_(audio_encoder_factory),
audio_decoder_factory_(audio_decoder_factory),
video_encoder_factory_(video_encoder_factory),
video_decoder_factory_(video_decoder_factory),
external_audio_mixer_(audio_mixer),
media_engine_(std::move(media_engine)),
call_factory_(std::move(call_factory)),
event_log_factory_(std::move(event_log_factory)) {

View File

@ -109,12 +109,8 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
std::unique_ptr<cricket::MediaEngineInterface> media_engine,
std::unique_ptr<webrtc::CallFactoryInterface> call_factory,
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory);
@ -131,10 +127,6 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
std::unique_ptr<rtc::Thread> owned_network_thread_;
std::unique_ptr<rtc::Thread> owned_worker_thread_;
Options options_;
// External Audio device used for audio playback.
rtc::scoped_refptr<AudioDeviceModule> default_adm_;
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory_;
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory_;
std::unique_ptr<cricket::ChannelManager> channel_manager_;
// External Video encoder factory. This can be NULL if the client has not
// injected any. In that case, video engine will use the internal SW encoder.
@ -144,9 +136,6 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
std::unique_ptr<cricket::WebRtcVideoDecoderFactory> video_decoder_factory_;
std::unique_ptr<rtc::BasicNetworkManager> default_network_manager_;
std::unique_ptr<rtc::BasicPacketSocketFactory> default_socket_factory_;
// External audio mixer. This can be NULL. In that case, internal audio mixer
// will be created and used.
rtc::scoped_refptr<AudioMixer> external_audio_mixer_;
std::unique_ptr<cricket::MediaEngineInterface> media_engine_;
std::unique_ptr<webrtc::CallFactoryInterface> call_factory_;
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory_;

View File

@ -660,9 +660,7 @@ class PeerConnectionFactoryForTest : public webrtc::PeerConnectionFactory {
return new rtc::RefCountedObject<PeerConnectionFactoryForTest>(
rtc::Thread::Current(), rtc::Thread::Current(), rtc::Thread::Current(),
FakeAudioCaptureModule::Create(), audio_encoder_factory,
audio_decoder_factory, nullptr, nullptr, nullptr,
std::move(media_engine), std::move(call_factory),
nullptr, nullptr, std::move(media_engine), std::move(call_factory),
std::move(event_log_factory));
}
@ -670,24 +668,16 @@ class PeerConnectionFactoryForTest : public webrtc::PeerConnectionFactory {
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
rtc::scoped_refptr<FakeAudioCaptureModule> fake_adm,
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
std::unique_ptr<cricket::MediaEngineInterface> media_engine,
std::unique_ptr<webrtc::CallFactoryInterface> call_factory,
std::unique_ptr<webrtc::RtcEventLogFactoryInterface> event_log_factory)
: webrtc::PeerConnectionFactory(network_thread,
worker_thread,
signaling_thread,
fake_adm,
audio_encoder_factory,
audio_decoder_factory,
video_encoder_factory,
video_decoder_factory,
audio_mixer,
std::move(media_engine),
std::move(call_factory),
std::move(event_log_factory)) {}

View File

@ -32,10 +32,6 @@ class FakePeerConnectionFactory
rtc::Thread::Current(),
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
std::unique_ptr<cricket::MediaEngineInterface>(),
std::unique_ptr<webrtc::CallFactoryInterface>(),
std::unique_ptr<RtcEventLogFactoryInterface>()) {}

View File

@ -197,10 +197,8 @@ JNI_FUNCTION_DECLARATION(
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
CreateModularPeerConnectionFactory(
network_thread.get(), worker_thread.get(), signaling_thread.get(),
adm, audio_encoder_factory, audio_decoder_factory,
video_encoder_factory, video_decoder_factory, audio_mixer,
std::move(media_engine), std::move(call_factory),
std::move(rtc_event_log_factory)));
video_encoder_factory, video_decoder_factory, std::move(media_engine),
std::move(call_factory), std::move(rtc_event_log_factory)));
RTC_CHECK(factory) << "Failed to create the peer connection factory; "
<< "WebRTC/libjingle init likely failed on this device";
// TODO(honghaiz): Maybe put the options as the argument of

View File

@ -110,12 +110,8 @@
_networkThread.get(),
_workerThread.get(),
_signalingThread.get(),
nullptr, // default_adm
nullptr, // audio_encoder_factory
nullptr, // audio_decoder_factory
nullptr, // video_encoder_factory
nullptr, // video_decoder_factory
nullptr, // audio_mixer
std::unique_ptr<cricket::MediaEngineInterface>(),
std::unique_ptr<webrtc::CallFactoryInterface>(),
std::unique_ptr<webrtc::RtcEventLogFactoryInterface>());