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 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 public sigslot::has_slots<> { | 55 public sigslot::has_slots<> { |
56 public: | 56 public: |
57 // Creates a proxy that will call "public interface" methods on the correct | 57 // Creates a proxy that will call "public interface" methods on the correct |
58 // thread. | 58 // thread. |
59 // | 59 // |
60 // Doesn't take ownership of any objects passed in. | 60 // Doesn't take ownership of any objects passed in. |
61 // | 61 // |
62 // |channel_manager| must not be null. | 62 // |channel_manager| must not be null. |
63 static std::unique_ptr<RtpTransportControllerInterface> CreateProxied( | 63 static std::unique_ptr<RtpTransportControllerInterface> CreateProxied( |
64 const cricket::MediaConfig& config, | 64 const cricket::MediaConfig& config, |
65 const RtpTransportParameters& parameters, | |
65 cricket::ChannelManager* channel_manager, | 66 cricket::ChannelManager* channel_manager, |
66 webrtc::RtcEventLog* event_log, | 67 webrtc::RtcEventLog* event_log, |
67 rtc::Thread* signaling_thread, | 68 rtc::Thread* signaling_thread, |
68 rtc::Thread* worker_thread); | 69 rtc::Thread* worker_thread); |
69 | 70 |
70 ~RtpTransportControllerAdapter() override; | 71 ~RtpTransportControllerAdapter() override; |
71 | 72 |
72 // RtpTransportControllerInterface implementation. | 73 // RtpTransportControllerInterface implementation. |
73 std::vector<RtpTransportInterface*> GetTransports() const override; | 74 std::vector<RtpTransportInterface*> GetTransports() const override; |
74 | 75 |
75 // These methods are used by OrtcFactory to create RtpTransports, RtpSenders | 76 // These methods are used by OrtcFactory to create RtpTransports, RtpSenders |
76 // and RtpReceivers using this controller. Called "CreateProxied" because | 77 // and RtpReceivers using this controller. Called "CreateProxied" because |
77 // these methods return proxies that will safely call methods on the correct | 78 // these methods return proxies that will safely call methods on the correct |
78 // thread. | 79 // thread. |
79 RTCErrorOr<std::unique_ptr<RtpTransportInterface>> CreateProxiedRtpTransport( | 80 RTCErrorOr<std::unique_ptr<RtpTransportInterface>> CreateProxiedRtpTransport( |
80 const RtcpParameters& rtcp_parameters, | 81 const RtpTransportParameters& rtcp_parameters, |
81 PacketTransportInterface* rtp, | 82 PacketTransportInterface* rtp, |
82 PacketTransportInterface* rtcp); | 83 PacketTransportInterface* rtcp); |
83 | 84 |
84 RTCErrorOr<std::unique_ptr<SrtpTransportInterface>> | 85 RTCErrorOr<std::unique_ptr<SrtpTransportInterface>> |
85 CreateProxiedSrtpTransport(const RtcpParameters& rtcp_parameters, | 86 CreateProxiedSrtpTransport(const RtpTransportParameters& rtcp_parameters, |
86 PacketTransportInterface* rtp, | 87 PacketTransportInterface* rtp, |
87 PacketTransportInterface* rtcp); | 88 PacketTransportInterface* rtcp); |
88 | 89 |
89 // |transport_proxy| needs to be a proxy to a transport because the | 90 // |transport_proxy| needs to be a proxy to a transport because the |
90 // application may call GetTransport() on the returned sender or receiver, | 91 // application may call GetTransport() on the returned sender or receiver, |
91 // and expects it to return a thread-safe transport proxy. | 92 // and expects it to return a thread-safe transport proxy. |
92 RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateProxiedRtpSender( | 93 RTCErrorOr<std::unique_ptr<OrtcRtpSenderInterface>> CreateProxiedRtpSender( |
93 cricket::MediaType kind, | 94 cricket::MediaType kind, |
94 RtpTransportInterface* transport_proxy); | 95 RtpTransportInterface* transport_proxy); |
95 RTCErrorOr<std::unique_ptr<OrtcRtpReceiverInterface>> | 96 RTCErrorOr<std::unique_ptr<OrtcRtpReceiverInterface>> |
96 CreateProxiedRtpReceiver(cricket::MediaType kind, | 97 CreateProxiedRtpReceiver(cricket::MediaType kind, |
97 RtpTransportInterface* transport_proxy); | 98 RtpTransportInterface* transport_proxy); |
98 | 99 |
99 // Methods used internally by other "adapter" classes. | 100 // Methods used internally by other "adapter" classes. |
100 rtc::Thread* signaling_thread() const { return signaling_thread_; } | 101 rtc::Thread* signaling_thread() const { return signaling_thread_; } |
101 rtc::Thread* worker_thread() const { return worker_thread_; } | 102 rtc::Thread* worker_thread() const { return worker_thread_; } |
102 | 103 |
103 RTCError SetRtcpParameters(const RtcpParameters& parameters, | 104 // |parameters.keepalive| will be set for ALL RTP transports in the call. |
104 RtpTransportInterface* inner_transport); | 105 RTCError SetRtpTransportAndParameters( |
Taylor Brandstetter
2017/08/03 01:18:03
Can remove "And" from this name.
sprang_webrtc
2017/08/03 13:08:14
Done.
| |
106 const RtpTransportParameters& parameters, | |
107 RtpTransportInterface* inner_transport); | |
105 | 108 |
106 cricket::VoiceChannel* voice_channel() { return voice_channel_; } | 109 cricket::VoiceChannel* voice_channel() { return voice_channel_; } |
107 cricket::VideoChannel* video_channel() { return video_channel_; } | 110 cricket::VideoChannel* video_channel() { return video_channel_; } |
108 | 111 |
109 // |primary_ssrc| out parameter is filled with either | 112 // |primary_ssrc| out parameter is filled with either |
110 // |parameters.encodings[0].ssrc|, or a generated SSRC if that's left unset. | 113 // |parameters.encodings[0].ssrc|, or a generated SSRC if that's left unset. |
111 RTCError ValidateAndApplyAudioSenderParameters( | 114 RTCError ValidateAndApplyAudioSenderParameters( |
112 const RtpParameters& parameters, | 115 const RtpParameters& parameters, |
113 uint32_t* primary_ssrc); | 116 uint32_t* primary_ssrc); |
114 RTCError ValidateAndApplyVideoSenderParameters( | 117 RTCError ValidateAndApplyVideoSenderParameters( |
115 const RtpParameters& parameters, | 118 const RtpParameters& parameters, |
116 uint32_t* primary_ssrc); | 119 uint32_t* primary_ssrc); |
117 RTCError ValidateAndApplyAudioReceiverParameters( | 120 RTCError ValidateAndApplyAudioReceiverParameters( |
118 const RtpParameters& parameters); | 121 const RtpParameters& parameters); |
119 RTCError ValidateAndApplyVideoReceiverParameters( | 122 RTCError ValidateAndApplyVideoReceiverParameters( |
120 const RtpParameters& parameters); | 123 const RtpParameters& parameters); |
121 | 124 |
122 protected: | 125 protected: |
123 RtpTransportControllerAdapter* GetInternal() override { return this; } | 126 RtpTransportControllerAdapter* GetInternal() override { return this; } |
124 | 127 |
125 private: | 128 private: |
126 // Only expected to be called by RtpTransportControllerAdapter::CreateProxied. | 129 // Only expected to be called by RtpTransportControllerAdapter::CreateProxied. |
127 RtpTransportControllerAdapter(const cricket::MediaConfig& config, | 130 RtpTransportControllerAdapter(const cricket::MediaConfig& config, |
131 const RtpTransportParameters& params, | |
128 cricket::ChannelManager* channel_manager, | 132 cricket::ChannelManager* channel_manager, |
129 webrtc::RtcEventLog* event_log, | 133 webrtc::RtcEventLog* event_log, |
130 rtc::Thread* signaling_thread, | 134 rtc::Thread* signaling_thread, |
131 rtc::Thread* worker_thread); | 135 rtc::Thread* worker_thread); |
132 void Init_w(); | 136 void Init_w(const RtpTransportParameters& params); |
133 void Close_w(); | 137 void Close_w(); |
134 | 138 |
135 // These return an error if another of the same type of object is already | 139 // These return an error if another of the same type of object is already |
136 // attached, or if |transport_proxy| can't be used with the sender/receiver | 140 // attached, or if |transport_proxy| can't be used with the sender/receiver |
137 // due to the limitation that the sender/receiver of the same media type must | 141 // due to the limitation that the sender/receiver of the same media type must |
138 // use the same transport. | 142 // use the same transport. |
139 RTCError AttachAudioSender(OrtcRtpSenderAdapter* sender, | 143 RTCError AttachAudioSender(OrtcRtpSenderAdapter* sender, |
140 RtpTransportInterface* inner_transport); | 144 RtpTransportInterface* inner_transport); |
141 RTCError AttachVideoSender(OrtcRtpSenderAdapter* sender, | 145 RTCError AttachVideoSender(OrtcRtpSenderAdapter* sender, |
142 RtpTransportInterface* inner_transport); | 146 RtpTransportInterface* inner_transport); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 | 190 |
187 rtc::Thread* signaling_thread_; | 191 rtc::Thread* signaling_thread_; |
188 rtc::Thread* worker_thread_; | 192 rtc::Thread* worker_thread_; |
189 // |transport_proxies_| and |inner_audio_transport_|/|inner_audio_transport_| | 193 // |transport_proxies_| and |inner_audio_transport_|/|inner_audio_transport_| |
190 // are somewhat redundant, but the latter are only set when | 194 // are somewhat redundant, but the latter are only set when |
191 // RtpSenders/RtpReceivers are attached to the transport. | 195 // RtpSenders/RtpReceivers are attached to the transport. |
192 std::vector<RtpTransportInterface*> transport_proxies_; | 196 std::vector<RtpTransportInterface*> transport_proxies_; |
193 RtpTransportInterface* inner_audio_transport_ = nullptr; | 197 RtpTransportInterface* inner_audio_transport_ = nullptr; |
194 RtpTransportInterface* inner_video_transport_ = nullptr; | 198 RtpTransportInterface* inner_video_transport_ = nullptr; |
195 const cricket::MediaConfig media_config_; | 199 const cricket::MediaConfig media_config_; |
200 RtpKeepAliveConfig keepalive_; | |
196 cricket::ChannelManager* channel_manager_; | 201 cricket::ChannelManager* channel_manager_; |
197 webrtc::RtcEventLog* event_log_; | 202 webrtc::RtcEventLog* event_log_; |
198 std::unique_ptr<Call> call_; | 203 std::unique_ptr<Call> call_; |
199 | 204 |
200 // BaseChannel takes content descriptions as input, so we store them here | 205 // BaseChannel takes content descriptions as input, so we store them here |
201 // such that they can be updated when a new RtpSenderAdapter/ | 206 // such that they can be updated when a new RtpSenderAdapter/ |
202 // RtpReceiverAdapter attaches itself. | 207 // RtpReceiverAdapter attaches itself. |
203 cricket::AudioContentDescription local_audio_description_; | 208 cricket::AudioContentDescription local_audio_description_; |
204 cricket::AudioContentDescription remote_audio_description_; | 209 cricket::AudioContentDescription remote_audio_description_; |
205 cricket::VideoContentDescription local_video_description_; | 210 cricket::VideoContentDescription local_video_description_; |
206 cricket::VideoContentDescription remote_video_description_; | 211 cricket::VideoContentDescription remote_video_description_; |
207 cricket::VoiceChannel* voice_channel_ = nullptr; | 212 cricket::VoiceChannel* voice_channel_ = nullptr; |
208 cricket::VideoChannel* video_channel_ = nullptr; | 213 cricket::VideoChannel* video_channel_ = nullptr; |
209 bool have_audio_sender_ = false; | 214 bool have_audio_sender_ = false; |
210 bool have_video_sender_ = false; | 215 bool have_video_sender_ = false; |
211 bool have_audio_receiver_ = false; | 216 bool have_audio_receiver_ = false; |
212 bool have_video_receiver_ = false; | 217 bool have_video_receiver_ = false; |
213 | 218 |
214 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpTransportControllerAdapter); | 219 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpTransportControllerAdapter); |
215 }; | 220 }; |
216 | 221 |
217 } // namespace webrtc | 222 } // namespace webrtc |
218 | 223 |
219 #endif // WEBRTC_ORTC_RTPTRANSPORTCONTROLLERADAPTER_H_ | 224 #endif // WEBRTC_ORTC_RTPTRANSPORTCONTROLLERADAPTER_H_ |
OLD | NEW |