OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_PC_ORTCFACTORY_H_ | 11 #ifndef WEBRTC_PC_ORTCFACTORY_H_ |
12 #define WEBRTC_PC_ORTCFACTORY_H_ | 12 #define WEBRTC_PC_ORTCFACTORY_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "webrtc/api/ortcfactoryinterface.h" | 16 #include "webrtc/api/ortcfactoryinterface.h" |
17 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/base/constructormagic.h" |
18 #include "webrtc/base/scoped_ref_ptr.h" | |
19 #include "webrtc/media/engine/webrtcmediaengine.h" | |
20 #include "webrtc/pc/channelmanager.h" | |
18 | 21 |
19 namespace webrtc { | 22 namespace webrtc { |
20 | 23 |
21 // Implementation of OrtcFactoryInterface. | 24 // Implementation of OrtcFactoryInterface. |
22 // | 25 // |
23 // See ortcfactoryinterface.h for documentation. | 26 // See ortcfactoryinterface.h for documentation. |
24 class OrtcFactory : public OrtcFactoryInterface { | 27 class OrtcFactory : public OrtcFactoryInterface { |
25 public: | 28 public: |
29 ~OrtcFactory() override; | |
30 | |
31 RTCErrorOr<std::unique_ptr<RtpTransportControllerInterface>> | |
32 CreateRtpTransportController() override; | |
33 | |
34 RTCErrorOr<std::unique_ptr<RtpTransportInterface>> CreateRtpTransport( | |
35 const RtcpParameters& rtcp_parameters, | |
36 PacketTransportInterface* rtp, | |
37 PacketTransportInterface* rtcp, | |
38 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
| |
39 | |
40 RtpCapabilities GetRtpSenderCapabilities( | |
41 cricket::MediaType kind) const override; | |
42 | |
43 RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateRtpSender( | |
44 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"
| |
45 const RtpParameters& rtp_parameters, | |
pthatcher1
2017/02/08 01:33:50
Why do you need to pass in the rtp_parameters?
| |
46 RtpTransportInterface* transport) override; | |
47 | |
48 RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateRtpSender( | |
49 cricket::MediaType kind, | |
50 const RtpParameters& rtp_parameters, | |
pthatcher1
2017/02/08 01:33:50
Why does it need to pass in the rtp_parameters?
| |
51 RtpTransportInterface* transport) override; | |
52 | |
53 RtpCapabilities GetRtpReceiverCapabilities( | |
54 cricket::MediaType kind) const override; | |
55 | |
56 RTCErrorOr<std::unique_ptr<OrtcRtpReceiverInterface>> CreateRtpReceiver( | |
57 cricket::MediaType kind, | |
58 const RtpParameters& rtp_parameters, | |
pthatcher1
2017/02/08 01:33:49
Same here
| |
59 RtpTransportInterface* transport) override; | |
60 | |
61 RTCErrorOr<std::unique_ptr<UdpTransportInterface>> | |
62 CreateUdpTransport(int family, uint16_t min_port, uint16_t max_port) override; | |
63 | |
64 rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource( | |
65 const cricket::AudioOptions& options) override; | |
66 | |
67 rtc::scoped_refptr<VideoTrackSourceInterface> CreateVideoSource( | |
68 std::unique_ptr<cricket::VideoCapturer> capturer, | |
69 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
| |
70 | |
71 rtc::scoped_refptr<VideoTrackInterface> CreateVideoTrack( | |
72 const std::string& id, | |
73 VideoTrackSourceInterface* source) override; | |
74 | |
75 rtc::scoped_refptr<AudioTrackInterface> CreateAudioTrack( | |
76 const std::string& id, | |
77 AudioSourceInterface* source) override; | |
pthatcher1
2017/02/08 01:33:50
Why is creating tracks part of ORTC?
| |
78 | |
79 rtc::Thread* network_thread() { return network_thread_; } | |
80 rtc::Thread* worker_thread() { return worker_thread_.get(); } | |
81 rtc::Thread* signaling_thread() { return signaling_thread_; } | |
82 | |
83 private: | |
84 // Should only be called by OrtcFactoryInterface::Create. | |
26 OrtcFactory(rtc::Thread* network_thread, | 85 OrtcFactory(rtc::Thread* network_thread, |
27 rtc::Thread* signaling_thread, | 86 rtc::Thread* signaling_thread, |
28 rtc::NetworkManager* network_manager, | 87 rtc::NetworkManager* network_manager, |
29 rtc::PacketSocketFactory* socket_factory); | 88 rtc::PacketSocketFactory* socket_factory, |
30 ~OrtcFactory() override; | 89 AudioDeviceModule* adm); |
31 std::unique_ptr<UdpTransportInterface> | |
32 CreateUdpTransport(int family, uint16_t min_port, uint16_t max_port) override; | |
33 | 90 |
34 rtc::Thread* network_thread() { return network_thread_; } | 91 // Performs initialization that can fail. Called by factory method after |
35 rtc::Thread* worker_thread() { return owned_worker_thread_.get(); } | 92 // construction, and if it fails, no object is returned. |
36 rtc::Thread* signaling_thread() { return signaling_thread_; } | 93 RTCError Initialize(); |
94 std::unique_ptr<cricket::MediaEngineInterface> CreateMediaEngine_w(); | |
37 | 95 |
38 private: | 96 // Threads and networking objects. |
39 rtc::Thread* network_thread_; | 97 rtc::Thread* network_thread_; |
40 rtc::Thread* signaling_thread_; | 98 rtc::Thread* signaling_thread_; |
41 rtc::NetworkManager* network_manager_; | 99 rtc::NetworkManager* network_manager_; |
42 rtc::PacketSocketFactory* socket_factory_; | 100 rtc::PacketSocketFactory* socket_factory_; |
101 AudioDeviceModule* adm_; | |
43 // If we created/own the objects above, these will be non-null and thus will | 102 // If we created/own the objects above, these will be non-null and thus will |
44 // be released automatically upon destruction. | 103 // be released automatically upon destruction. |
45 std::unique_ptr<rtc::Thread> owned_network_thread_; | 104 std::unique_ptr<rtc::Thread> owned_network_thread_; |
46 std::unique_ptr<rtc::Thread> owned_worker_thread_; | |
47 bool wraps_signaling_thread_ = false; | 105 bool wraps_signaling_thread_ = false; |
48 std::unique_ptr<rtc::NetworkManager> owned_network_manager_; | 106 std::unique_ptr<rtc::NetworkManager> owned_network_manager_; |
49 std::unique_ptr<rtc::PacketSocketFactory> owned_socket_factory_; | 107 std::unique_ptr<rtc::PacketSocketFactory> owned_socket_factory_; |
108 // We always own the worker thread. | |
109 std::unique_ptr<rtc::Thread> worker_thread_; | |
110 // Media-releated objects. | |
111 std::unique_ptr<RtcEventLog> null_event_log_; | |
112 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory_; | |
113 std::unique_ptr<cricket::ChannelManager> channel_manager_; | |
114 | |
115 friend class OrtcFactoryInterface; | |
116 | |
50 RTC_DISALLOW_COPY_AND_ASSIGN(OrtcFactory); | 117 RTC_DISALLOW_COPY_AND_ASSIGN(OrtcFactory); |
51 }; | 118 }; |
52 | 119 |
53 BEGIN_OWNED_PROXY_MAP(OrtcFactory) | |
54 PROXY_SIGNALING_THREAD_DESTRUCTOR() | |
55 PROXY_METHOD3(std::unique_ptr<UdpTransportInterface>, | |
56 CreateUdpTransport, | |
57 int, | |
58 uint16_t, | |
59 uint16_t) | |
60 END_PROXY_MAP() | |
61 | |
62 } // namespace webrtc | 120 } // namespace webrtc |
63 | 121 |
64 #endif // WEBRTC_PC_ORTCFACTORY_H_ | 122 #endif // WEBRTC_PC_ORTCFACTORY_H_ |
OLD | NEW |