Support building WebRTC without audio and video. This CL makes the WebRTC more modular and allows the users to build WebRTC without audio and video(DataChannel only). The BUILD files in call/, logging/, media/ and pc/ are modified to support modular WebRTC. The dependencies on Call and RtcEventLog are removed from the PeerConnection. Instead of being created internally, they would be passed in by the PeerConnectionFactory. Add the CreateModularPeerConnectionFactory function which allow the users to create a PeerConnectionFactory with the modules they need. If the users want to build WebRTC without audio and video, they can pass in null pointers for modules they don't need. (MediaEngine, VideoEncoderFactory etc.) BUG=webrtc:7613 Review-Url: https://codereview.webrtc.org/2854123003 Cr-Commit-Position: refs/heads/master@{#18617}
diff --git a/webrtc/pc/peerconnectionfactory.h b/webrtc/pc/peerconnectionfactory.h index 58d3e7f..c93594d 100644 --- a/webrtc/pc/peerconnectionfactory.h +++ b/webrtc/pc/peerconnectionfactory.h
@@ -106,9 +106,6 @@ protected: PeerConnectionFactory( - rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory, - rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory); - PeerConnectionFactory( rtc::Thread* network_thread, rtc::Thread* worker_thread, rtc::Thread* signaling_thread, @@ -117,15 +114,21 @@ rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory, cricket::WebRtcVideoEncoderFactory* video_encoder_factory, cricket::WebRtcVideoDecoderFactory* video_decoder_factory, - rtc::scoped_refptr<AudioMixer> audio_mixer); + 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); virtual ~PeerConnectionFactory(); private: - bool owns_ptrs_; + std::unique_ptr<Call> CreateCall_w(RtcEventLog* event_log); + bool wraps_current_thread_; rtc::Thread* network_thread_; rtc::Thread* worker_thread_; rtc::Thread* signaling_thread_; + 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_; @@ -143,6 +146,9 @@ // 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_; }; } // namespace webrtc