| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license | |
| 5 * that can be found in the LICENSE file in the root of the source | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #ifndef WEBRTC_API_PEERCONNECTIONFACTORY_H_ | |
| 12 #define WEBRTC_API_PEERCONNECTIONFACTORY_H_ | |
| 13 | |
| 14 #include <memory> | |
| 15 #include <string> | |
| 16 | |
| 17 #include "webrtc/api/mediacontroller.h" | |
| 18 #include "webrtc/api/mediastreaminterface.h" | |
| 19 #include "webrtc/api/peerconnectioninterface.h" | |
| 20 #include "webrtc/base/scoped_ref_ptr.h" | |
| 21 #include "webrtc/base/thread.h" | |
| 22 #include "webrtc/base/rtccertificategenerator.h" | |
| 23 #include "webrtc/pc/channelmanager.h" | |
| 24 | |
| 25 namespace rtc { | |
| 26 class BasicNetworkManager; | |
| 27 class BasicPacketSocketFactory; | |
| 28 } | |
| 29 | |
| 30 namespace webrtc { | |
| 31 | |
| 32 class RtcEventLog; | |
| 33 | |
| 34 class PeerConnectionFactory : public PeerConnectionFactoryInterface { | |
| 35 public: | |
| 36 void SetOptions(const Options& options) override; | |
| 37 | |
| 38 // Deprecated, use version without constraints. | |
| 39 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( | |
| 40 const PeerConnectionInterface::RTCConfiguration& configuration, | |
| 41 const MediaConstraintsInterface* constraints, | |
| 42 std::unique_ptr<cricket::PortAllocator> allocator, | |
| 43 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, | |
| 44 PeerConnectionObserver* observer) override; | |
| 45 | |
| 46 virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( | |
| 47 const PeerConnectionInterface::RTCConfiguration& configuration, | |
| 48 std::unique_ptr<cricket::PortAllocator> allocator, | |
| 49 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, | |
| 50 PeerConnectionObserver* observer) override; | |
| 51 | |
| 52 bool Initialize(); | |
| 53 | |
| 54 rtc::scoped_refptr<MediaStreamInterface> | |
| 55 CreateLocalMediaStream(const std::string& label) override; | |
| 56 | |
| 57 virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( | |
| 58 const cricket::AudioOptions& options) override; | |
| 59 // Deprecated, use version without constraints. | |
| 60 rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( | |
| 61 const MediaConstraintsInterface* constraints) override; | |
| 62 | |
| 63 virtual rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource( | |
| 64 cricket::VideoCapturer* capturer) override; | |
| 65 // This version supports filtering on width, height and frame rate. | |
| 66 // For the "constraints=null" case, use the version without constraints. | |
| 67 // TODO(hta): Design a version without MediaConstraintsInterface. | |
| 68 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5617 | |
| 69 rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource( | |
| 70 cricket::VideoCapturer* capturer, | |
| 71 const MediaConstraintsInterface* constraints) override; | |
| 72 | |
| 73 rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack( | |
| 74 const std::string& id, | |
| 75 VideoTrackSourceInterface* video_source) override; | |
| 76 | |
| 77 rtc::scoped_refptr<AudioTrackInterface> | |
| 78 CreateAudioTrack(const std::string& id, | |
| 79 AudioSourceInterface* audio_source) override; | |
| 80 | |
| 81 bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) override; | |
| 82 void StopAecDump() override; | |
| 83 // TODO(ivoc) Remove after Chrome is updated. | |
| 84 bool StartRtcEventLog(rtc::PlatformFile file) override { return false; } | |
| 85 // TODO(ivoc) Remove after Chrome is updated. | |
| 86 bool StartRtcEventLog(rtc::PlatformFile file, | |
| 87 int64_t max_size_bytes) override { | |
| 88 return false; | |
| 89 } | |
| 90 // TODO(ivoc) Remove after Chrome is updated. | |
| 91 void StopRtcEventLog() override {} | |
| 92 | |
| 93 virtual webrtc::MediaControllerInterface* CreateMediaController( | |
| 94 const cricket::MediaConfig& config, | |
| 95 RtcEventLog* event_log) const; | |
| 96 virtual cricket::TransportController* CreateTransportController( | |
| 97 cricket::PortAllocator* port_allocator, | |
| 98 bool redetermine_role_on_ice_restart); | |
| 99 virtual rtc::Thread* signaling_thread(); | |
| 100 virtual rtc::Thread* worker_thread(); | |
| 101 virtual rtc::Thread* network_thread(); | |
| 102 const Options& options() const { return options_; } | |
| 103 | |
| 104 protected: | |
| 105 PeerConnectionFactory(); | |
| 106 PeerConnectionFactory( | |
| 107 rtc::Thread* network_thread, | |
| 108 rtc::Thread* worker_thread, | |
| 109 rtc::Thread* signaling_thread, | |
| 110 AudioDeviceModule* default_adm, | |
| 111 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& | |
| 112 audio_decoder_factory, | |
| 113 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, | |
| 114 cricket::WebRtcVideoDecoderFactory* video_decoder_factory, | |
| 115 rtc::scoped_refptr<AudioMixer> audio_mixer); | |
| 116 virtual ~PeerConnectionFactory(); | |
| 117 | |
| 118 private: | |
| 119 cricket::MediaEngineInterface* CreateMediaEngine_w(); | |
| 120 | |
| 121 bool owns_ptrs_; | |
| 122 bool wraps_current_thread_; | |
| 123 rtc::Thread* network_thread_; | |
| 124 rtc::Thread* worker_thread_; | |
| 125 rtc::Thread* signaling_thread_; | |
| 126 Options options_; | |
| 127 // External Audio device used for audio playback. | |
| 128 rtc::scoped_refptr<AudioDeviceModule> default_adm_; | |
| 129 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory_; | |
| 130 std::unique_ptr<cricket::ChannelManager> channel_manager_; | |
| 131 // External Video encoder factory. This can be NULL if the client has not | |
| 132 // injected any. In that case, video engine will use the internal SW encoder. | |
| 133 std::unique_ptr<cricket::WebRtcVideoEncoderFactory> video_encoder_factory_; | |
| 134 // External Video decoder factory. This can be NULL if the client has not | |
| 135 // injected any. In that case, video engine will use the internal SW decoder. | |
| 136 std::unique_ptr<cricket::WebRtcVideoDecoderFactory> video_decoder_factory_; | |
| 137 std::unique_ptr<rtc::BasicNetworkManager> default_network_manager_; | |
| 138 std::unique_ptr<rtc::BasicPacketSocketFactory> default_socket_factory_; | |
| 139 // External audio mixer. This can be NULL. In that case, internal audio mixer | |
| 140 // will be created and used. | |
| 141 rtc::scoped_refptr<AudioMixer> external_audio_mixer_; | |
| 142 }; | |
| 143 | |
| 144 } // namespace webrtc | |
| 145 | |
| 146 #endif // WEBRTC_API_PEERCONNECTIONFACTORY_H_ | |
| OLD | NEW |