Chromium Code Reviews| Index: webrtc/pc/ortcfactory.h |
| diff --git a/webrtc/pc/ortcfactory.h b/webrtc/pc/ortcfactory.h |
| index 65fe10fd53d4c75ecb886ba1b171afade3651446..df447571c2bd2b4b1b32606c0eb8bfaba42cff0b 100644 |
| --- a/webrtc/pc/ortcfactory.h |
| +++ b/webrtc/pc/ortcfactory.h |
| @@ -15,6 +15,9 @@ |
| #include "webrtc/api/ortcfactoryinterface.h" |
| #include "webrtc/base/constructormagic.h" |
| +#include "webrtc/base/scoped_ref_ptr.h" |
| +#include "webrtc/media/engine/webrtcmediaengine.h" |
| +#include "webrtc/pc/channelmanager.h" |
| namespace webrtc { |
| @@ -23,42 +26,97 @@ namespace webrtc { |
| // See ortcfactoryinterface.h for documentation. |
| class OrtcFactory : public OrtcFactoryInterface { |
| public: |
| - OrtcFactory(rtc::Thread* network_thread, |
| - rtc::Thread* signaling_thread, |
| - rtc::NetworkManager* network_manager, |
| - rtc::PacketSocketFactory* socket_factory); |
| ~OrtcFactory() override; |
| - std::unique_ptr<UdpTransportInterface> |
| + |
| + RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>> |
| + CreateRtpTransportController() override; |
| + |
| + RTCErrorOr<std::unique_ptr<RtpTransportInterface>> CreateRtpTransport( |
| + const RtcpParameters& rtcp_parameters, |
| + PacketTransportInterface* rtp, |
| + PacketTransportInterface* rtcp, |
| + RtpTransportControllerInterface* transport_controller) override; |
|
pthatcher1
2017/02/08 01:33:49
I think we should consider making the common case
pthatcher1
2017/02/08 01:33:49
I think the transport_controller should be the fir
Taylor Brandstetter
2017/02/10 00:19:46
Good idea. Done.
Taylor Brandstetter
2017/02/10 00:19:46
const parameters should go first according to the
|
| + |
| + RtpCapabilities GetRtpSenderCapabilities( |
| + cricket::MediaType kind) const override; |
| + |
| + RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateRtpSender( |
| + rtc::scoped_refptr<MediaStreamTrackInterface> track, |
|
pthatcher1
2017/02/08 01:33:49
Why do you need to pass in a track?
Taylor Brandstetter
2017/02/10 00:19:46
Because this is a combination of "create and send"
|
| + const RtpParameters& rtp_parameters, |
|
pthatcher1
2017/02/08 01:33:50
Why do you need to pass in the rtp_parameters?
|
| + RtpTransportInterface* transport) override; |
| + |
| + RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateRtpSender( |
| + cricket::MediaType kind, |
| + const RtpParameters& rtp_parameters, |
|
pthatcher1
2017/02/08 01:33:50
Why does it need to pass in the rtp_parameters?
|
| + RtpTransportInterface* transport) override; |
| + |
| + RtpCapabilities GetRtpReceiverCapabilities( |
| + cricket::MediaType kind) const override; |
| + |
| + RTCErrorOr<std::unique_ptr<OrtcRtpReceiverInterface>> CreateRtpReceiver( |
| + cricket::MediaType kind, |
| + const RtpParameters& rtp_parameters, |
|
pthatcher1
2017/02/08 01:33:49
Same here
|
| + RtpTransportInterface* transport) override; |
| + |
| + RTCErrorOr<std::unique_ptr<UdpTransportInterface>> |
| CreateUdpTransport(int family, uint16_t min_port, uint16_t max_port) override; |
| + rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( |
| + const cricket::AudioOptions& options) override; |
| + |
| + rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource( |
| + std::unique_ptr<cricket::VideoCapturer> capturer, |
| + const MediaConstraintsInterface* constraints) override; |
|
pthatcher1
2017/02/08 01:33:49
Why are CreateAudioSource and CreateVideoSource pa
Taylor Brandstetter
2017/02/10 00:19:46
Because these objects may need to use the same thr
|
| + |
| + rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack( |
| + const std::string& id, |
| + VideoTrackSourceInterface* source) override; |
| + |
| + rtc::scoped_refptr<AudioTrackInterface> CreateAudioTrack( |
| + const std::string& id, |
| + AudioSourceInterface* source) override; |
|
pthatcher1
2017/02/08 01:33:50
Why is creating tracks part of ORTC?
|
| + |
| rtc::Thread* network_thread() { return network_thread_; } |
| - rtc::Thread* worker_thread() { return owned_worker_thread_.get(); } |
| + rtc::Thread* worker_thread() { return worker_thread_.get(); } |
| rtc::Thread* signaling_thread() { return signaling_thread_; } |
| private: |
| + // Should only be called by OrtcFactoryInterface::Create. |
| + OrtcFactory(rtc::Thread* network_thread, |
| + rtc::Thread* signaling_thread, |
| + rtc::NetworkManager* network_manager, |
| + rtc::PacketSocketFactory* socket_factory, |
| + AudioDeviceModule* adm); |
| + |
| + // Performs initialization that can fail. Called by factory method after |
| + // construction, and if it fails, no object is returned. |
| + RTCError Initialize(); |
| + std::unique_ptr<cricket::MediaEngineInterface> CreateMediaEngine_w(); |
| + |
| + // Threads and networking objects. |
| rtc::Thread* network_thread_; |
| rtc::Thread* signaling_thread_; |
| rtc::NetworkManager* network_manager_; |
| rtc::PacketSocketFactory* socket_factory_; |
| + AudioDeviceModule* adm_; |
| // If we created/own the objects above, these will be non-null and thus will |
| // be released automatically upon destruction. |
| std::unique_ptr<rtc::Thread> owned_network_thread_; |
| - std::unique_ptr<rtc::Thread> owned_worker_thread_; |
| bool wraps_signaling_thread_ = false; |
| std::unique_ptr<rtc::NetworkManager> owned_network_manager_; |
| std::unique_ptr<rtc::PacketSocketFactory> owned_socket_factory_; |
| + // We always own the worker thread. |
| + std::unique_ptr<rtc::Thread> worker_thread_; |
| + // Media-releated objects. |
| + std::unique_ptr<RtcEventLog> null_event_log_; |
| + rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory_; |
| + std::unique_ptr<cricket::ChannelManager> channel_manager_; |
| + |
| + friend class OrtcFactoryInterface; |
| + |
| RTC_DISALLOW_COPY_AND_ASSIGN(OrtcFactory); |
| }; |
| -BEGIN_OWNED_PROXY_MAP(OrtcFactory) |
| - PROXY_SIGNALING_THREAD_DESTRUCTOR() |
| - PROXY_METHOD3(std::unique_ptr<UdpTransportInterface>, |
| - CreateUdpTransport, |
| - int, |
| - uint16_t, |
| - uint16_t) |
| -END_PROXY_MAP() |
| - |
| } // namespace webrtc |
| #endif // WEBRTC_PC_ORTCFACTORY_H_ |