OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 namespace webrtc { | 41 namespace webrtc { |
42 class AudioSinkInterface; | 42 class AudioSinkInterface; |
43 } // namespace webrtc | 43 } // namespace webrtc |
44 | 44 |
45 namespace cricket { | 45 namespace cricket { |
46 | 46 |
47 struct CryptoParams; | 47 struct CryptoParams; |
48 class MediaContentDescription; | 48 class MediaContentDescription; |
49 | 49 |
50 enum SinkType { | |
51 SINK_PRE_CRYPTO, // Sink packets before encryption or after decryption. | |
52 SINK_POST_CRYPTO // Sink packets after encryption or before decryption. | |
53 }; | |
54 | |
55 // BaseChannel contains logic common to voice and video, including | 50 // BaseChannel contains logic common to voice and video, including |
56 // enable, marshaling calls to a worker thread, and | 51 // enable, marshaling calls to a worker thread, and |
57 // connection and media monitors. | 52 // connection and media monitors. |
58 // | 53 // |
59 // WARNING! SUBCLASSES MUST CALL Deinit() IN THEIR DESTRUCTORS! | 54 // WARNING! SUBCLASSES MUST CALL Deinit() IN THEIR DESTRUCTORS! |
60 // This is required to avoid a data race between the destructor modifying the | 55 // This is required to avoid a data race between the destructor modifying the |
61 // vtable, and the media channel's thread using BaseChannel as the | 56 // vtable, and the media channel's thread using BaseChannel as the |
62 // NetworkInterface. | 57 // NetworkInterface. |
63 | 58 |
64 class BaseChannel | 59 class BaseChannel |
65 : public rtc::MessageHandler, public sigslot::has_slots<>, | 60 : public rtc::MessageHandler, public sigslot::has_slots<>, |
66 public MediaChannel::NetworkInterface, | 61 public MediaChannel::NetworkInterface, |
67 public ConnectionStatsGetter { | 62 public ConnectionStatsGetter { |
68 public: | 63 public: |
69 BaseChannel(rtc::Thread* thread, | 64 BaseChannel(rtc::Thread* worker_thread, |
| 65 rtc::Thread* network_thread, |
70 MediaChannel* channel, | 66 MediaChannel* channel, |
71 TransportController* transport_controller, | 67 TransportController* transport_controller, |
72 const std::string& content_name, | 68 const std::string& content_name, |
73 bool rtcp); | 69 bool rtcp); |
74 virtual ~BaseChannel(); | 70 virtual ~BaseChannel(); |
75 bool Init(); | 71 bool Init(); |
76 // Deinit may be called multiple times and is simply ignored if it's alreay | 72 // Deinit may be called multiple times and is simply ignored if it's alreay |
77 // done. | 73 // done. |
78 void Deinit(); | 74 void Deinit(); |
79 | 75 |
80 rtc::Thread* worker_thread() const { return worker_thread_; } | 76 rtc::Thread* worker_thread() const { return worker_thread_; } |
| 77 rtc::Thread* network_thread() const { return network_thread_; } |
81 const std::string& content_name() const { return content_name_; } | 78 const std::string& content_name() const { return content_name_; } |
82 const std::string& transport_name() const { return transport_name_; } | 79 const std::string& transport_name() const { return transport_name_; } |
83 TransportChannel* transport_channel() const { | 80 TransportChannel* transport_channel() const { |
84 return transport_channel_; | 81 return transport_channel_; |
85 } | 82 } |
86 TransportChannel* rtcp_transport_channel() const { | 83 TransportChannel* rtcp_transport_channel() const { |
87 return rtcp_transport_channel_; | 84 return rtcp_transport_channel_; |
88 } | 85 } |
89 bool enabled() const { return enabled_; } | 86 bool enabled() const { return enabled_; } |
90 | 87 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 BundleFilter* bundle_filter() { return &bundle_filter_; } | 133 BundleFilter* bundle_filter() { return &bundle_filter_; } |
137 | 134 |
138 const std::vector<StreamParams>& local_streams() const { | 135 const std::vector<StreamParams>& local_streams() const { |
139 return local_streams_; | 136 return local_streams_; |
140 } | 137 } |
141 const std::vector<StreamParams>& remote_streams() const { | 138 const std::vector<StreamParams>& remote_streams() const { |
142 return remote_streams_; | 139 return remote_streams_; |
143 } | 140 } |
144 | 141 |
145 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure; | 142 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure; |
146 void SignalDtlsSetupFailure_w(bool rtcp); | 143 void SignalDtlsSetupFailure_n(bool rtcp); |
147 void SignalDtlsSetupFailure_s(bool rtcp); | 144 void SignalDtlsSetupFailure_s(bool rtcp); |
148 | 145 |
149 // Used for latency measurements. | 146 // Used for latency measurements. |
150 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; | 147 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; |
151 | 148 |
152 // Made public for easier testing. | 149 // Made public for easier testing. |
153 void SetReadyToSend(bool rtcp, bool ready); | 150 void SetReadyToSend(bool rtcp, bool ready); |
154 | 151 |
155 // Only public for unit tests. Otherwise, consider protected. | 152 // Only public for unit tests. Otherwise, consider protected. |
156 int SetOption(SocketType type, rtc::Socket::Option o, int val) | 153 int SetOption(SocketType type, rtc::Socket::Option o, int val) |
157 override; | 154 override; |
158 | 155 |
159 SrtpFilter* srtp_filter() { return &srtp_filter_; } | 156 SrtpFilter* srtp_filter() { return &srtp_filter_; } |
160 | 157 |
161 protected: | 158 protected: |
162 virtual MediaChannel* media_channel() const { return media_channel_; } | 159 virtual MediaChannel* media_channel() const { return media_channel_; } |
163 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is | 160 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is |
164 // true). Gets the transport channels from |transport_controller_|. | 161 // true). Gets the transport channels from |transport_controller_|. |
165 bool SetTransport_w(const std::string& transport_name); | 162 bool SetTransport_n(const std::string& transport_name); |
166 | 163 |
167 void set_transport_channel(TransportChannel* transport); | 164 void set_transport_channel(TransportChannel* transport); |
168 void set_rtcp_transport_channel(TransportChannel* transport, | 165 void set_rtcp_transport_channel(TransportChannel* transport, |
169 bool update_writablity); | 166 bool update_writablity); |
170 | 167 |
171 bool was_ever_writable() const { return was_ever_writable_; } | 168 bool was_ever_writable() const { return was_ever_writable_; } |
172 void set_local_content_direction(MediaContentDirection direction) { | 169 void set_local_content_direction(MediaContentDirection direction) { |
173 local_content_direction_ = direction; | 170 local_content_direction_ = direction; |
174 } | 171 } |
175 void set_remote_content_direction(MediaContentDirection direction) { | 172 void set_remote_content_direction(MediaContentDirection direction) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 void OnSelectedCandidatePairChanged( | 207 void OnSelectedCandidatePairChanged( |
211 TransportChannel* channel, | 208 TransportChannel* channel, |
212 CandidatePairInterface* selected_candidate_pair, | 209 CandidatePairInterface* selected_candidate_pair, |
213 int last_sent_packet_id); | 210 int last_sent_packet_id); |
214 | 211 |
215 bool PacketIsRtcp(const TransportChannel* channel, const char* data, | 212 bool PacketIsRtcp(const TransportChannel* channel, const char* data, |
216 size_t len); | 213 size_t len); |
217 bool SendPacket(bool rtcp, | 214 bool SendPacket(bool rtcp, |
218 rtc::CopyOnWriteBuffer* packet, | 215 rtc::CopyOnWriteBuffer* packet, |
219 const rtc::PacketOptions& options); | 216 const rtc::PacketOptions& options); |
| 217 |
220 virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet); | 218 virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet); |
221 void HandlePacket(bool rtcp, rtc::CopyOnWriteBuffer* packet, | 219 void HandlePacket(bool rtcp, rtc::CopyOnWriteBuffer* packet, |
222 const rtc::PacketTime& packet_time); | 220 const rtc::PacketTime& packet_time); |
223 | 221 |
224 void EnableMedia_w(); | 222 void EnableMedia_w(); |
225 void DisableMedia_w(); | 223 void DisableMedia_w(); |
226 void UpdateWritableState_w(); | 224 void UpdateWritableState_n(); |
227 void ChannelWritable_w(); | 225 void ChannelWritable_n(); |
228 void ChannelNotWritable_w(); | 226 void ChannelNotWritable_n(); |
229 bool AddRecvStream_w(const StreamParams& sp); | 227 bool AddRecvStream_w(const StreamParams& sp); |
230 bool RemoveRecvStream_w(uint32_t ssrc); | 228 bool RemoveRecvStream_w(uint32_t ssrc); |
231 bool AddSendStream_w(const StreamParams& sp); | 229 bool AddSendStream_w(const StreamParams& sp); |
232 bool RemoveSendStream_w(uint32_t ssrc); | 230 bool RemoveSendStream_w(uint32_t ssrc); |
233 virtual bool ShouldSetupDtlsSrtp() const; | 231 virtual bool ShouldSetupDtlsSrtp() const; |
234 // Do the DTLS key expansion and impose it on the SRTP/SRTCP filters. | 232 // Do the DTLS key expansion and impose it on the SRTP/SRTCP filters. |
235 // |rtcp_channel| indicates whether to set up the RTP or RTCP filter. | 233 // |rtcp_channel| indicates whether to set up the RTP or RTCP filter. |
236 bool SetupDtlsSrtp(bool rtcp_channel); | 234 bool SetupDtlsSrtp_n(bool rtcp_channel); |
237 void MaybeSetupDtlsSrtp_w(); | 235 void MaybeSetupDtlsSrtp_n(); |
238 // Set the DTLS-SRTP cipher policy on this channel as appropriate. | 236 // Set the DTLS-SRTP cipher policy on this channel as appropriate. |
239 bool SetDtlsSrtpCryptoSuites(TransportChannel* tc, bool rtcp); | 237 bool SetDtlsSrtpCryptoSuites(TransportChannel* tc, bool rtcp); |
240 | 238 |
241 virtual void ChangeState() = 0; | 239 void ChangeState(); |
| 240 virtual void ChangeState_w() = 0; |
242 | 241 |
243 // Gets the content info appropriate to the channel (audio or video). | 242 // Gets the content info appropriate to the channel (audio or video). |
244 virtual const ContentInfo* GetFirstContent( | 243 virtual const ContentInfo* GetFirstContent( |
245 const SessionDescription* sdesc) = 0; | 244 const SessionDescription* sdesc) = 0; |
246 bool UpdateLocalStreams_w(const std::vector<StreamParams>& streams, | 245 bool UpdateLocalStreams_w(const std::vector<StreamParams>& streams, |
247 ContentAction action, | 246 ContentAction action, |
248 std::string* error_desc); | 247 std::string* error_desc); |
249 bool UpdateRemoteStreams_w(const std::vector<StreamParams>& streams, | 248 bool UpdateRemoteStreams_w(const std::vector<StreamParams>& streams, |
250 ContentAction action, | 249 ContentAction action, |
251 std::string* error_desc); | 250 std::string* error_desc); |
252 virtual bool SetLocalContent_w(const MediaContentDescription* content, | 251 virtual bool SetLocalContent_w(const MediaContentDescription* content, |
253 ContentAction action, | 252 ContentAction action, |
254 std::string* error_desc) = 0; | 253 std::string* error_desc) = 0; |
255 virtual bool SetRemoteContent_w(const MediaContentDescription* content, | 254 virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
256 ContentAction action, | 255 ContentAction action, |
257 std::string* error_desc) = 0; | 256 std::string* error_desc) = 0; |
258 bool SetRtpTransportParameters_w(const MediaContentDescription* content, | 257 bool SetRtpTransportParameters(const MediaContentDescription* content, |
259 ContentAction action, | 258 ContentAction action, |
260 ContentSource src, | 259 ContentSource src, |
261 std::string* error_desc); | 260 std::string* error_desc); |
262 | 261 |
263 // Helper method to get RTP Absoulute SendTime extension header id if | 262 // Helper method to get RTP Absoulute SendTime extension header id if |
264 // present in remote supported extensions list. | 263 // present in remote supported extensions list. |
265 void MaybeCacheRtpAbsSendTimeHeaderExtension( | 264 void MaybeCacheRtpAbsSendTimeHeaderExtension( |
266 const std::vector<RtpHeaderExtension>& extensions); | 265 const std::vector<RtpHeaderExtension>& extensions); |
267 | 266 |
268 bool CheckSrtpConfig(const std::vector<CryptoParams>& cryptos, | 267 bool CheckSrtpConfig(const std::vector<CryptoParams>& cryptos, |
269 bool* dtls, | 268 bool* dtls, |
270 std::string* error_desc); | 269 std::string* error_desc); |
271 bool SetSrtp_w(const std::vector<CryptoParams>& params, | 270 bool SetSrtp_n(const std::vector<CryptoParams>& params, |
272 ContentAction action, | 271 ContentAction action, |
273 ContentSource src, | 272 ContentSource src, |
274 std::string* error_desc); | 273 std::string* error_desc); |
275 void ActivateRtcpMux_w(); | 274 void ActivateRtcpMux_n(); |
276 bool SetRtcpMux_w(bool enable, | 275 bool SetRtcpMux_n(bool enable, |
277 ContentAction action, | 276 ContentAction action, |
278 ContentSource src, | 277 ContentSource src, |
279 std::string* error_desc); | 278 std::string* error_desc); |
280 | 279 |
281 // From MessageHandler | 280 // From MessageHandler |
282 void OnMessage(rtc::Message* pmsg) override; | 281 void OnMessage(rtc::Message* pmsg) override; |
283 | 282 |
284 // Handled in derived classes | 283 // Handled in derived classes |
285 // Get the SRTP crypto suites to use for RTP media | 284 // Get the SRTP crypto suites to use for RTP media |
286 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const = 0; | 285 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const = 0; |
287 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor, | 286 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor, |
288 const std::vector<ConnectionInfo>& infos) = 0; | 287 const std::vector<ConnectionInfo>& infos) = 0; |
289 | 288 |
290 // Helper function for invoking bool-returning methods on the worker thread. | 289 // Helper function for invoking bool-returning methods on the worker thread. |
291 template <class FunctorT> | 290 template <class FunctorT> |
292 bool InvokeOnWorker(const FunctorT& functor) { | 291 bool InvokeOnWorker(const FunctorT& functor) { |
293 return worker_thread_->Invoke<bool>(functor); | 292 return worker_thread_->Invoke<bool>(functor); |
294 } | 293 } |
295 | 294 |
296 private: | 295 private: |
297 rtc::Thread* worker_thread_; | 296 rtc::Thread* const worker_thread_; |
298 TransportController* transport_controller_; | 297 rtc::Thread* const network_thread_; |
299 MediaChannel* media_channel_; | 298 TransportController* const transport_controller_; |
| 299 MediaChannel* const media_channel_; |
300 std::vector<StreamParams> local_streams_; | 300 std::vector<StreamParams> local_streams_; |
301 std::vector<StreamParams> remote_streams_; | 301 std::vector<StreamParams> remote_streams_; |
302 | 302 |
303 const std::string content_name_; | 303 const std::string content_name_; |
304 std::string transport_name_; | 304 std::string transport_name_; |
305 bool rtcp_transport_enabled_; | 305 bool rtcp_transport_enabled_; |
306 TransportChannel* transport_channel_; | 306 TransportChannel* transport_channel_; |
307 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; | 307 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; |
308 TransportChannel* rtcp_transport_channel_; | 308 TransportChannel* rtcp_transport_channel_; |
309 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; | 309 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; |
(...skipping 11 matching lines...) Expand all Loading... |
321 bool has_received_packet_; | 321 bool has_received_packet_; |
322 bool dtls_keyed_; | 322 bool dtls_keyed_; |
323 bool secure_required_; | 323 bool secure_required_; |
324 int rtp_abs_sendtime_extn_id_; | 324 int rtp_abs_sendtime_extn_id_; |
325 }; | 325 }; |
326 | 326 |
327 // VoiceChannel is a specialization that adds support for early media, DTMF, | 327 // VoiceChannel is a specialization that adds support for early media, DTMF, |
328 // and input/output level monitoring. | 328 // and input/output level monitoring. |
329 class VoiceChannel : public BaseChannel { | 329 class VoiceChannel : public BaseChannel { |
330 public: | 330 public: |
331 VoiceChannel(rtc::Thread* thread, | 331 VoiceChannel(rtc::Thread* worker_thread, |
| 332 rtc::Thread* network_thread, |
332 MediaEngineInterface* media_engine, | 333 MediaEngineInterface* media_engine, |
333 VoiceMediaChannel* channel, | 334 VoiceMediaChannel* channel, |
334 TransportController* transport_controller, | 335 TransportController* transport_controller, |
335 const std::string& content_name, | 336 const std::string& content_name, |
336 bool rtcp); | 337 bool rtcp); |
337 ~VoiceChannel(); | 338 ~VoiceChannel(); |
338 bool Init(); | 339 bool Init(); |
339 | 340 |
340 // Configure sending media on the stream with SSRC |ssrc| | 341 // Configure sending media on the stream with SSRC |ssrc| |
341 // If there is only one sending stream SSRC 0 can be used. | 342 // If there is only one sending stream SSRC 0 can be used. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 void GetActiveStreams_w(AudioInfo::StreamList* actives); | 391 void GetActiveStreams_w(AudioInfo::StreamList* actives); |
391 webrtc::RtpParameters GetRtpParameters_w(uint32_t ssrc) const; | 392 webrtc::RtpParameters GetRtpParameters_w(uint32_t ssrc) const; |
392 bool SetRtpParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); | 393 bool SetRtpParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); |
393 | 394 |
394 private: | 395 private: |
395 // overrides from BaseChannel | 396 // overrides from BaseChannel |
396 virtual void OnChannelRead(TransportChannel* channel, | 397 virtual void OnChannelRead(TransportChannel* channel, |
397 const char* data, size_t len, | 398 const char* data, size_t len, |
398 const rtc::PacketTime& packet_time, | 399 const rtc::PacketTime& packet_time, |
399 int flags); | 400 int flags); |
400 virtual void ChangeState(); | 401 void ChangeState_w() override; |
401 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); | 402 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); |
402 virtual bool SetLocalContent_w(const MediaContentDescription* content, | 403 virtual bool SetLocalContent_w(const MediaContentDescription* content, |
403 ContentAction action, | 404 ContentAction action, |
404 std::string* error_desc); | 405 std::string* error_desc); |
405 virtual bool SetRemoteContent_w(const MediaContentDescription* content, | 406 virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
406 ContentAction action, | 407 ContentAction action, |
407 std::string* error_desc); | 408 std::string* error_desc); |
408 void HandleEarlyMediaTimeout(); | 409 void HandleEarlyMediaTimeout(); |
409 bool InsertDtmf_w(uint32_t ssrc, int event, int duration); | 410 bool InsertDtmf_w(uint32_t ssrc, int event, int duration); |
410 bool SetOutputVolume_w(uint32_t ssrc, double volume); | 411 bool SetOutputVolume_w(uint32_t ssrc, double volume); |
(...skipping 17 matching lines...) Expand all Loading... |
428 // SetSendParameters. | 429 // SetSendParameters. |
429 AudioSendParameters last_send_params_; | 430 AudioSendParameters last_send_params_; |
430 // Last AudioRecvParameters sent down to the media_channel() via | 431 // Last AudioRecvParameters sent down to the media_channel() via |
431 // SetRecvParameters. | 432 // SetRecvParameters. |
432 AudioRecvParameters last_recv_params_; | 433 AudioRecvParameters last_recv_params_; |
433 }; | 434 }; |
434 | 435 |
435 // VideoChannel is a specialization for video. | 436 // VideoChannel is a specialization for video. |
436 class VideoChannel : public BaseChannel { | 437 class VideoChannel : public BaseChannel { |
437 public: | 438 public: |
438 VideoChannel(rtc::Thread* thread, | 439 VideoChannel(rtc::Thread* worker_thread, |
| 440 rtc::Thread* netwokr_thread, |
439 VideoMediaChannel* channel, | 441 VideoMediaChannel* channel, |
440 TransportController* transport_controller, | 442 TransportController* transport_controller, |
441 const std::string& content_name, | 443 const std::string& content_name, |
442 bool rtcp); | 444 bool rtcp); |
443 ~VideoChannel(); | 445 ~VideoChannel(); |
444 bool Init(); | 446 bool Init(); |
445 | 447 |
446 // downcasts a MediaChannel | 448 // downcasts a MediaChannel |
447 virtual VideoMediaChannel* media_channel() const { | 449 virtual VideoMediaChannel* media_channel() const { |
448 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel()); | 450 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel()); |
(...skipping 13 matching lines...) Expand all Loading... |
462 void StartMediaMonitor(int cms); | 464 void StartMediaMonitor(int cms); |
463 void StopMediaMonitor(); | 465 void StopMediaMonitor(); |
464 sigslot::signal2<VideoChannel*, const VideoMediaInfo&> SignalMediaMonitor; | 466 sigslot::signal2<VideoChannel*, const VideoMediaInfo&> SignalMediaMonitor; |
465 | 467 |
466 bool SetVideoSend(uint32_t ssrc, bool enable, const VideoOptions* options); | 468 bool SetVideoSend(uint32_t ssrc, bool enable, const VideoOptions* options); |
467 webrtc::RtpParameters GetRtpParameters(uint32_t ssrc) const; | 469 webrtc::RtpParameters GetRtpParameters(uint32_t ssrc) const; |
468 bool SetRtpParameters(uint32_t ssrc, const webrtc::RtpParameters& parameters); | 470 bool SetRtpParameters(uint32_t ssrc, const webrtc::RtpParameters& parameters); |
469 | 471 |
470 private: | 472 private: |
471 // overrides from BaseChannel | 473 // overrides from BaseChannel |
472 virtual void ChangeState(); | 474 void ChangeState_w() override; |
473 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); | 475 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); |
474 virtual bool SetLocalContent_w(const MediaContentDescription* content, | 476 virtual bool SetLocalContent_w(const MediaContentDescription* content, |
475 ContentAction action, | 477 ContentAction action, |
476 std::string* error_desc); | 478 std::string* error_desc); |
477 virtual bool SetRemoteContent_w(const MediaContentDescription* content, | 479 virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
478 ContentAction action, | 480 ContentAction action, |
479 std::string* error_desc); | 481 std::string* error_desc); |
480 bool GetStats_w(VideoMediaInfo* stats); | 482 bool GetStats_w(VideoMediaInfo* stats); |
481 webrtc::RtpParameters GetRtpParameters_w(uint32_t ssrc) const; | 483 webrtc::RtpParameters GetRtpParameters_w(uint32_t ssrc) const; |
482 bool SetRtpParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); | 484 bool SetRtpParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); |
(...skipping 11 matching lines...) Expand all Loading... |
494 // SetSendParameters. | 496 // SetSendParameters. |
495 VideoSendParameters last_send_params_; | 497 VideoSendParameters last_send_params_; |
496 // Last VideoRecvParameters sent down to the media_channel() via | 498 // Last VideoRecvParameters sent down to the media_channel() via |
497 // SetRecvParameters. | 499 // SetRecvParameters. |
498 VideoRecvParameters last_recv_params_; | 500 VideoRecvParameters last_recv_params_; |
499 }; | 501 }; |
500 | 502 |
501 // DataChannel is a specialization for data. | 503 // DataChannel is a specialization for data. |
502 class DataChannel : public BaseChannel { | 504 class DataChannel : public BaseChannel { |
503 public: | 505 public: |
504 DataChannel(rtc::Thread* thread, | 506 DataChannel(rtc::Thread* worker_thread, |
| 507 rtc::Thread* network_thread, |
505 DataMediaChannel* media_channel, | 508 DataMediaChannel* media_channel, |
506 TransportController* transport_controller, | 509 TransportController* transport_controller, |
507 const std::string& content_name, | 510 const std::string& content_name, |
508 bool rtcp); | 511 bool rtcp); |
509 ~DataChannel(); | 512 ~DataChannel(); |
510 bool Init(); | 513 bool Init(); |
511 | 514 |
512 virtual bool SendData(const SendDataParams& params, | 515 virtual bool SendData(const SendDataParams& params, |
513 const rtc::CopyOnWriteBuffer& payload, | 516 const rtc::CopyOnWriteBuffer& payload, |
514 SendDataResult* result); | 517 SendDataResult* result); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 // Same as SetDataChannelType, but extracts the type from the | 584 // Same as SetDataChannelType, but extracts the type from the |
582 // DataContentDescription. | 585 // DataContentDescription. |
583 bool SetDataChannelTypeFromContent(const DataContentDescription* content, | 586 bool SetDataChannelTypeFromContent(const DataContentDescription* content, |
584 std::string* error_desc); | 587 std::string* error_desc); |
585 virtual bool SetLocalContent_w(const MediaContentDescription* content, | 588 virtual bool SetLocalContent_w(const MediaContentDescription* content, |
586 ContentAction action, | 589 ContentAction action, |
587 std::string* error_desc); | 590 std::string* error_desc); |
588 virtual bool SetRemoteContent_w(const MediaContentDescription* content, | 591 virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
589 ContentAction action, | 592 ContentAction action, |
590 std::string* error_desc); | 593 std::string* error_desc); |
591 virtual void ChangeState(); | 594 void ChangeState_w() override; |
592 virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet); | 595 virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet); |
593 | 596 |
594 virtual void OnMessage(rtc::Message* pmsg); | 597 virtual void OnMessage(rtc::Message* pmsg); |
595 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; | 598 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; |
596 virtual void OnConnectionMonitorUpdate( | 599 virtual void OnConnectionMonitorUpdate( |
597 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); | 600 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); |
598 virtual void OnMediaMonitorUpdate( | 601 virtual void OnMediaMonitorUpdate( |
599 DataMediaChannel* media_channel, const DataMediaInfo& info); | 602 DataMediaChannel* media_channel, const DataMediaInfo& info); |
600 virtual bool ShouldSetupDtlsSrtp() const; | 603 virtual bool ShouldSetupDtlsSrtp() const; |
601 void OnDataReceived( | 604 void OnDataReceived( |
(...skipping 12 matching lines...) Expand all Loading... |
614 // SetSendParameters. | 617 // SetSendParameters. |
615 DataSendParameters last_send_params_; | 618 DataSendParameters last_send_params_; |
616 // Last DataRecvParameters sent down to the media_channel() via | 619 // Last DataRecvParameters sent down to the media_channel() via |
617 // SetRecvParameters. | 620 // SetRecvParameters. |
618 DataRecvParameters last_recv_params_; | 621 DataRecvParameters last_recv_params_; |
619 }; | 622 }; |
620 | 623 |
621 } // namespace cricket | 624 } // namespace cricket |
622 | 625 |
623 #endif // WEBRTC_PC_CHANNEL_H_ | 626 #endif // WEBRTC_PC_CHANNEL_H_ |
OLD | NEW |