/* * Copyright 2011 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef PC_PEERCONNECTIONFACTORY_H_ #define PC_PEERCONNECTIONFACTORY_H_ #include #include #include "api/mediastreaminterface.h" #include "api/peerconnectioninterface.h" #include "media/sctp/sctptransportinternal.h" #include "pc/channelmanager.h" #include "rtc_base/rtccertificategenerator.h" #include "rtc_base/scoped_ref_ptr.h" #include "rtc_base/thread.h" namespace rtc { class BasicNetworkManager; class BasicPacketSocketFactory; } namespace webrtc { class RtcEventLog; class PeerConnectionFactory : public PeerConnectionFactoryInterface { public: // Use the overloads of CreateVideoSource that take raw VideoCapturer // pointers from PeerConnectionFactoryInterface. // TODO(deadbeef): Remove this using statement once those overloads are // removed. using PeerConnectionFactoryInterface::CreateVideoSource; void SetOptions(const Options& options) override; // Deprecated, use version without constraints. rtc::scoped_refptr CreatePeerConnection( const PeerConnectionInterface::RTCConfiguration& configuration, const MediaConstraintsInterface* constraints, std::unique_ptr allocator, std::unique_ptr cert_generator, PeerConnectionObserver* observer) override; rtc::scoped_refptr CreatePeerConnection( const PeerConnectionInterface::RTCConfiguration& configuration, std::unique_ptr allocator, std::unique_ptr cert_generator, PeerConnectionObserver* observer) override; bool Initialize(); rtc::scoped_refptr CreateLocalMediaStream(const std::string& label) override; rtc::scoped_refptr CreateAudioSource( const cricket::AudioOptions& options) override; // Deprecated, use version without constraints. rtc::scoped_refptr CreateAudioSource( const MediaConstraintsInterface* constraints) override; rtc::scoped_refptr CreateVideoSource( std::unique_ptr capturer) override; // This version supports filtering on width, height and frame rate. // For the "constraints=null" case, use the version without constraints. // TODO(hta): Design a version without MediaConstraintsInterface. // https://bugs.chromium.org/p/webrtc/issues/detail?id=5617 rtc::scoped_refptr CreateVideoSource( std::unique_ptr capturer, const MediaConstraintsInterface* constraints) override; rtc::scoped_refptr CreateVideoTrack( const std::string& id, VideoTrackSourceInterface* video_source) override; rtc::scoped_refptr CreateAudioTrack(const std::string& id, AudioSourceInterface* audio_source) override; bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) override; void StopAecDump() override; virtual cricket::TransportController* CreateTransportController( cricket::PortAllocator* port_allocator, bool redetermine_role_on_ice_restart); virtual std::unique_ptr CreateSctpTransportInternalFactory(); virtual cricket::ChannelManager* channel_manager(); virtual rtc::Thread* signaling_thread(); virtual rtc::Thread* worker_thread(); virtual rtc::Thread* network_thread(); const Options& options() const { return options_; } protected: PeerConnectionFactory( rtc::Thread* network_thread, rtc::Thread* worker_thread, rtc::Thread* signaling_thread, std::unique_ptr media_engine, std::unique_ptr call_factory, std::unique_ptr event_log_factory); virtual ~PeerConnectionFactory(); private: std::unique_ptr CreateRtcEventLog_w(); std::unique_ptr CreateCall_w(RtcEventLog* event_log); bool wraps_current_thread_; rtc::Thread* network_thread_; rtc::Thread* worker_thread_; rtc::Thread* signaling_thread_; std::unique_ptr owned_network_thread_; std::unique_ptr owned_worker_thread_; Options options_; std::unique_ptr channel_manager_; std::unique_ptr default_network_manager_; std::unique_ptr default_socket_factory_; std::unique_ptr media_engine_; std::unique_ptr call_factory_; std::unique_ptr event_log_factory_; }; } // namespace webrtc #endif // PC_PEERCONNECTIONFACTORY_H_