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}
diff --git a/api/peerconnectioninterface.h b/api/peerconnectioninterface.h
index 3753da4..5f82cbd 100644
--- a/api/peerconnectioninterface.h
+++ b/api/peerconnectioninterface.h
@@ -1229,12 +1229,8 @@
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);
diff --git a/pc/createpeerconnectionfactory.cc b/pc/createpeerconnectionfactory.cc
index ed0ff2a..d0a0b5b 100644
--- a/pc/createpeerconnectionfactory.cc
+++ b/pc/createpeerconnectionfactory.cc
@@ -71,10 +71,9 @@
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 @@
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>
diff --git a/pc/peerconnectionfactory.cc b/pc/peerconnectionfactory.cc
index cb88e25..c90c259 100644
--- a/pc/peerconnectionfactory.cc
+++ b/pc/peerconnectionfactory.cc
@@ -46,20 +46,15 @@
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 @@
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 @@
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)) {
diff --git a/pc/peerconnectionfactory.h b/pc/peerconnectionfactory.h
index dc62137..381a048 100644
--- a/pc/peerconnectionfactory.h
+++ b/pc/peerconnectionfactory.h
@@ -109,12 +109,8 @@
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 @@
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 @@
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_;
diff --git a/pc/peerconnectioninterface_unittest.cc b/pc/peerconnectioninterface_unittest.cc
index 8154b2d..bd26ce3 100644
--- a/pc/peerconnectioninterface_unittest.cc
+++ b/pc/peerconnectioninterface_unittest.cc
@@ -660,9 +660,7 @@
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 @@
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)) {}
diff --git a/pc/test/mock_peerconnection.h b/pc/test/mock_peerconnection.h
index e4343ff..17770fa 100644
--- a/pc/test/mock_peerconnection.h
+++ b/pc/test/mock_peerconnection.h
@@ -32,10 +32,6 @@
rtc::Thread::Current(),
nullptr,
nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
std::unique_ptr<cricket::MediaEngineInterface>(),
std::unique_ptr<webrtc::CallFactoryInterface>(),
std::unique_ptr<RtcEventLogFactoryInterface>()) {}
diff --git a/sdk/android/src/jni/pc/peerconnectionfactory_jni.cc b/sdk/android/src/jni/pc/peerconnectionfactory_jni.cc
index d1aea83..f48580c 100644
--- a/sdk/android/src/jni/pc/peerconnectionfactory_jni.cc
+++ b/sdk/android/src/jni/pc/peerconnectionfactory_jni.cc
@@ -197,10 +197,8 @@
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
diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm b/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm
index a42d760..9694108 100644
--- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm
+++ b/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnectionFactory.mm
@@ -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>());