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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 public ConnectionStatsGetter { | 76 public ConnectionStatsGetter { |
77 public: | 77 public: |
78 // |rtcp| represents whether or not this channel uses RTCP. | 78 // |rtcp| represents whether or not this channel uses RTCP. |
79 // If |srtp_required| is true, the channel will not send or receive any | 79 // If |srtp_required| is true, the channel will not send or receive any |
80 // RTP/RTCP packets without using SRTP (either using SDES or DTLS-SRTP). | 80 // RTP/RTCP packets without using SRTP (either using SDES or DTLS-SRTP). |
81 BaseChannel(rtc::Thread* worker_thread, | 81 BaseChannel(rtc::Thread* worker_thread, |
82 rtc::Thread* network_thread, | 82 rtc::Thread* network_thread, |
83 rtc::Thread* signaling_thread, | 83 rtc::Thread* signaling_thread, |
84 MediaChannel* channel, | 84 MediaChannel* channel, |
85 const std::string& content_name, | 85 const std::string& content_name, |
86 bool rtcp_mux_required, | 86 bool rtcp, |
87 bool srtp_required); | 87 bool srtp_required); |
88 virtual ~BaseChannel(); | 88 virtual ~BaseChannel(); |
89 bool Init_w(TransportChannel* rtp_transport, | 89 bool Init_w(TransportChannel* rtp_transport, |
90 TransportChannel* rtcp_transport); | 90 TransportChannel* rtcp_transport); |
91 // Deinit may be called multiple times and is simply ignored if it's already | 91 // Deinit may be called multiple times and is simply ignored if it's already |
92 // done. | 92 // done. |
93 void Deinit(); | 93 void Deinit(); |
94 | 94 |
95 rtc::Thread* worker_thread() const { return worker_thread_; } | 95 rtc::Thread* worker_thread() const { return worker_thread_; } |
96 rtc::Thread* network_thread() const { return network_thread_; } | 96 rtc::Thread* network_thread() const { return network_thread_; } |
97 const std::string& content_name() const { return content_name_; } | 97 const std::string& content_name() const { return content_name_; } |
98 const std::string& transport_name() const { return transport_name_; } | 98 const std::string& transport_name() const { return transport_name_; } |
99 bool enabled() const { return enabled_; } | 99 bool enabled() const { return enabled_; } |
100 | 100 |
101 // This function returns true if we are using SRTP. | 101 // This function returns true if we are using SRTP. |
102 bool secure() const { return srtp_filter_.IsActive(); } | 102 bool secure() const { return srtp_filter_.IsActive(); } |
103 // The following function returns true if we are using | 103 // The following function returns true if we are using |
104 // DTLS-based keying. If you turned off SRTP later, however | 104 // DTLS-based keying. If you turned off SRTP later, however |
105 // you could have secure() == false and dtls_secure() == true. | 105 // you could have secure() == false and dtls_secure() == true. |
106 bool secure_dtls() const { return dtls_keyed_; } | 106 bool secure_dtls() const { return dtls_keyed_; } |
107 | 107 |
108 bool writable() const { return writable_; } | 108 bool writable() const { return writable_; } |
109 | 109 |
| 110 // Activate RTCP mux, regardless of the state so far. Once |
| 111 // activated, it can not be deactivated, and if the remote |
| 112 // description doesn't support RTCP mux, setting the remote |
| 113 // description will fail. |
| 114 void ActivateRtcpMux(); |
110 bool SetTransport(TransportChannel* rtp_transport, | 115 bool SetTransport(TransportChannel* rtp_transport, |
111 TransportChannel* rtcp_transport); | 116 TransportChannel* rtcp_transport); |
112 bool PushdownLocalDescription(const SessionDescription* local_desc, | 117 bool PushdownLocalDescription(const SessionDescription* local_desc, |
113 ContentAction action, | 118 ContentAction action, |
114 std::string* error_desc); | 119 std::string* error_desc); |
115 bool PushdownRemoteDescription(const SessionDescription* remote_desc, | 120 bool PushdownRemoteDescription(const SessionDescription* remote_desc, |
116 ContentAction action, | 121 ContentAction action, |
117 std::string* error_desc); | 122 std::string* error_desc); |
118 // Channel control | 123 // Channel control |
119 bool SetLocalContent(const MediaContentDescription* content, | 124 bool SetLocalContent(const MediaContentDescription* content, |
(...skipping 29 matching lines...) Expand all Loading... |
149 sigslot::signal2<BaseChannel*, bool> SignalDtlsSrtpSetupFailure; | 154 sigslot::signal2<BaseChannel*, bool> SignalDtlsSrtpSetupFailure; |
150 void SignalDtlsSrtpSetupFailure_n(bool rtcp); | 155 void SignalDtlsSrtpSetupFailure_n(bool rtcp); |
151 void SignalDtlsSrtpSetupFailure_s(bool rtcp); | 156 void SignalDtlsSrtpSetupFailure_s(bool rtcp); |
152 | 157 |
153 // Used for latency measurements. | 158 // Used for latency measurements. |
154 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; | 159 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; |
155 | 160 |
156 // Forward TransportChannel SignalSentPacket to worker thread. | 161 // Forward TransportChannel SignalSentPacket to worker thread. |
157 sigslot::signal1<const rtc::SentPacket&> SignalSentPacket; | 162 sigslot::signal1<const rtc::SentPacket&> SignalSentPacket; |
158 | 163 |
159 // Emitted whenever rtcp-mux is fully negotiated and the rtcp-transport can | 164 // Emitted whenever the rtcp-mux is active and the rtcp-transport can be |
160 // be destroyed. | 165 // destroyed. |
161 // Fired on the network thread. | 166 sigslot::signal1<const std::string&> SignalDestroyRtcpTransport; |
162 sigslot::signal1<const std::string&> SignalRtcpMuxFullyActive; | |
163 | 167 |
164 TransportChannel* rtp_transport() const { return rtp_transport_; } | 168 TransportChannel* rtp_transport() const { return rtp_transport_; } |
165 TransportChannel* rtcp_transport() const { return rtcp_transport_; } | 169 TransportChannel* rtcp_transport() const { return rtcp_transport_; } |
166 | 170 |
167 bool NeedsRtcpTransport(); | 171 bool NeedsRtcpTransport(); |
168 | 172 |
169 // Made public for easier testing. | 173 // Made public for easier testing. |
170 // | 174 // |
171 // Updates "ready to send" for an individual channel, and informs the media | 175 // Updates "ready to send" for an individual channel, and informs the media |
172 // channel that the transport is ready to send if each channel (in use) is | 176 // channel that the transport is ready to send if each channel (in use) is |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 void MaybeCacheRtpAbsSendTimeHeaderExtension_w( | 328 void MaybeCacheRtpAbsSendTimeHeaderExtension_w( |
325 const std::vector<webrtc::RtpExtension>& extensions); | 329 const std::vector<webrtc::RtpExtension>& extensions); |
326 | 330 |
327 bool CheckSrtpConfig_n(const std::vector<CryptoParams>& cryptos, | 331 bool CheckSrtpConfig_n(const std::vector<CryptoParams>& cryptos, |
328 bool* dtls, | 332 bool* dtls, |
329 std::string* error_desc); | 333 std::string* error_desc); |
330 bool SetSrtp_n(const std::vector<CryptoParams>& params, | 334 bool SetSrtp_n(const std::vector<CryptoParams>& params, |
331 ContentAction action, | 335 ContentAction action, |
332 ContentSource src, | 336 ContentSource src, |
333 std::string* error_desc); | 337 std::string* error_desc); |
| 338 void ActivateRtcpMux_n(); |
334 bool SetRtcpMux_n(bool enable, | 339 bool SetRtcpMux_n(bool enable, |
335 ContentAction action, | 340 ContentAction action, |
336 ContentSource src, | 341 ContentSource src, |
337 std::string* error_desc); | 342 std::string* error_desc); |
338 | 343 |
339 // From MessageHandler | 344 // From MessageHandler |
340 void OnMessage(rtc::Message* pmsg) override; | 345 void OnMessage(rtc::Message* pmsg) override; |
341 | 346 |
342 const rtc::CryptoOptions& crypto_options() const { | 347 const rtc::CryptoOptions& crypto_options() const { |
343 return crypto_options_; | 348 return crypto_options_; |
(...skipping 26 matching lines...) Expand all Loading... |
370 | 375 |
371 rtc::Thread* const worker_thread_; | 376 rtc::Thread* const worker_thread_; |
372 rtc::Thread* const network_thread_; | 377 rtc::Thread* const network_thread_; |
373 rtc::Thread* const signaling_thread_; | 378 rtc::Thread* const signaling_thread_; |
374 rtc::AsyncInvoker invoker_; | 379 rtc::AsyncInvoker invoker_; |
375 | 380 |
376 const std::string content_name_; | 381 const std::string content_name_; |
377 std::unique_ptr<ConnectionMonitor> connection_monitor_; | 382 std::unique_ptr<ConnectionMonitor> connection_monitor_; |
378 | 383 |
379 std::string transport_name_; | 384 std::string transport_name_; |
380 // True if RTCP-multiplexing is required. In other words, no standalone RTCP | 385 // Is RTCP used at all by this type of channel? |
381 // transport will ever be used for this channel. | 386 // Expected to be true (as of typing this) for everything except data |
382 const bool rtcp_mux_required_; | 387 // channels. |
| 388 const bool rtcp_enabled_; |
383 // TODO(johan): Replace TransportChannel* with rtc::PacketTransportInterface*. | 389 // TODO(johan): Replace TransportChannel* with rtc::PacketTransportInterface*. |
384 TransportChannel* rtp_transport_ = nullptr; | 390 TransportChannel* rtp_transport_ = nullptr; |
385 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; | 391 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; |
386 TransportChannel* rtcp_transport_ = nullptr; | 392 TransportChannel* rtcp_transport_ = nullptr; |
387 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; | 393 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; |
388 SrtpFilter srtp_filter_; | 394 SrtpFilter srtp_filter_; |
389 RtcpMuxFilter rtcp_mux_filter_; | 395 RtcpMuxFilter rtcp_mux_filter_; |
390 BundleFilter bundle_filter_; | 396 BundleFilter bundle_filter_; |
391 bool rtp_ready_to_send_ = false; | 397 bool rtp_ready_to_send_ = false; |
392 bool rtcp_ready_to_send_ = false; | 398 bool rtcp_ready_to_send_ = false; |
(...skipping 22 matching lines...) Expand all Loading... |
415 // VoiceChannel is a specialization that adds support for early media, DTMF, | 421 // VoiceChannel is a specialization that adds support for early media, DTMF, |
416 // and input/output level monitoring. | 422 // and input/output level monitoring. |
417 class VoiceChannel : public BaseChannel { | 423 class VoiceChannel : public BaseChannel { |
418 public: | 424 public: |
419 VoiceChannel(rtc::Thread* worker_thread, | 425 VoiceChannel(rtc::Thread* worker_thread, |
420 rtc::Thread* network_thread, | 426 rtc::Thread* network_thread, |
421 rtc::Thread* signaling_thread, | 427 rtc::Thread* signaling_thread, |
422 MediaEngineInterface* media_engine, | 428 MediaEngineInterface* media_engine, |
423 VoiceMediaChannel* channel, | 429 VoiceMediaChannel* channel, |
424 const std::string& content_name, | 430 const std::string& content_name, |
425 bool rtcp_mux_required, | 431 bool rtcp, |
426 bool srtp_required); | 432 bool srtp_required); |
427 ~VoiceChannel(); | 433 ~VoiceChannel(); |
428 bool Init_w(TransportChannel* rtp_transport, | 434 bool Init_w(TransportChannel* rtp_transport, |
429 TransportChannel* rtcp_transport); | 435 TransportChannel* rtcp_transport); |
430 | 436 |
431 // Configure sending media on the stream with SSRC |ssrc| | 437 // Configure sending media on the stream with SSRC |ssrc| |
432 // If there is only one sending stream SSRC 0 can be used. | 438 // If there is only one sending stream SSRC 0 can be used. |
433 bool SetAudioSend(uint32_t ssrc, | 439 bool SetAudioSend(uint32_t ssrc, |
434 bool enable, | 440 bool enable, |
435 const AudioOptions* options, | 441 const AudioOptions* options, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 }; | 540 }; |
535 | 541 |
536 // VideoChannel is a specialization for video. | 542 // VideoChannel is a specialization for video. |
537 class VideoChannel : public BaseChannel { | 543 class VideoChannel : public BaseChannel { |
538 public: | 544 public: |
539 VideoChannel(rtc::Thread* worker_thread, | 545 VideoChannel(rtc::Thread* worker_thread, |
540 rtc::Thread* network_thread, | 546 rtc::Thread* network_thread, |
541 rtc::Thread* signaling_thread, | 547 rtc::Thread* signaling_thread, |
542 VideoMediaChannel* channel, | 548 VideoMediaChannel* channel, |
543 const std::string& content_name, | 549 const std::string& content_name, |
544 bool rtcp_mux_required, | 550 bool rtcp, |
545 bool srtp_required); | 551 bool srtp_required); |
546 ~VideoChannel(); | 552 ~VideoChannel(); |
547 bool Init_w(TransportChannel* rtp_transport, | 553 bool Init_w(TransportChannel* rtp_transport, |
548 TransportChannel* rtcp_transport); | 554 TransportChannel* rtcp_transport); |
549 | 555 |
550 // downcasts a MediaChannel | 556 // downcasts a MediaChannel |
551 VideoMediaChannel* media_channel() const override { | 557 VideoMediaChannel* media_channel() const override { |
552 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel()); | 558 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel()); |
553 } | 559 } |
554 | 560 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 }; | 620 }; |
615 | 621 |
616 // RtpDataChannel is a specialization for data. | 622 // RtpDataChannel is a specialization for data. |
617 class RtpDataChannel : public BaseChannel { | 623 class RtpDataChannel : public BaseChannel { |
618 public: | 624 public: |
619 RtpDataChannel(rtc::Thread* worker_thread, | 625 RtpDataChannel(rtc::Thread* worker_thread, |
620 rtc::Thread* network_thread, | 626 rtc::Thread* network_thread, |
621 rtc::Thread* signaling_thread, | 627 rtc::Thread* signaling_thread, |
622 DataMediaChannel* channel, | 628 DataMediaChannel* channel, |
623 const std::string& content_name, | 629 const std::string& content_name, |
624 bool rtcp_mux_required, | 630 bool rtcp, |
625 bool srtp_required); | 631 bool srtp_required); |
626 ~RtpDataChannel(); | 632 ~RtpDataChannel(); |
627 bool Init_w(TransportChannel* rtp_transport, | 633 bool Init_w(TransportChannel* rtp_transport, |
628 TransportChannel* rtcp_transport); | 634 TransportChannel* rtcp_transport); |
629 | 635 |
630 virtual bool SendData(const SendDataParams& params, | 636 virtual bool SendData(const SendDataParams& params, |
631 const rtc::CopyOnWriteBuffer& payload, | 637 const rtc::CopyOnWriteBuffer& payload, |
632 SendDataResult* result); | 638 SendDataResult* result); |
633 | 639 |
634 void StartMediaMonitor(int cms); | 640 void StartMediaMonitor(int cms); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 // SetSendParameters. | 727 // SetSendParameters. |
722 DataSendParameters last_send_params_; | 728 DataSendParameters last_send_params_; |
723 // Last DataRecvParameters sent down to the media_channel() via | 729 // Last DataRecvParameters sent down to the media_channel() via |
724 // SetRecvParameters. | 730 // SetRecvParameters. |
725 DataRecvParameters last_recv_params_; | 731 DataRecvParameters last_recv_params_; |
726 }; | 732 }; |
727 | 733 |
728 } // namespace cricket | 734 } // namespace cricket |
729 | 735 |
730 #endif // WEBRTC_PC_CHANNEL_H_ | 736 #endif // WEBRTC_PC_CHANNEL_H_ |
OLD | NEW |