Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: webrtc/pc/channel.h

Issue 2622613004: Refactoring of RTCP options in BaseChannel. (Closed)
Patch Set: Minor renaming/adding a comment, which makes sense to do after this refactoring. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/webrtcsession.cc ('k') | webrtc/pc/channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, 86 bool rtcp_mux_required,
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();
115 bool SetTransport(TransportChannel* rtp_transport, 110 bool SetTransport(TransportChannel* rtp_transport,
116 TransportChannel* rtcp_transport); 111 TransportChannel* rtcp_transport);
117 bool PushdownLocalDescription(const SessionDescription* local_desc, 112 bool PushdownLocalDescription(const SessionDescription* local_desc,
118 ContentAction action, 113 ContentAction action,
119 std::string* error_desc); 114 std::string* error_desc);
120 bool PushdownRemoteDescription(const SessionDescription* remote_desc, 115 bool PushdownRemoteDescription(const SessionDescription* remote_desc,
121 ContentAction action, 116 ContentAction action,
122 std::string* error_desc); 117 std::string* error_desc);
123 // Channel control 118 // Channel control
124 bool SetLocalContent(const MediaContentDescription* content, 119 bool SetLocalContent(const MediaContentDescription* content,
(...skipping 29 matching lines...) Expand all
154 sigslot::signal2<BaseChannel*, bool> SignalDtlsSrtpSetupFailure; 149 sigslot::signal2<BaseChannel*, bool> SignalDtlsSrtpSetupFailure;
155 void SignalDtlsSrtpSetupFailure_n(bool rtcp); 150 void SignalDtlsSrtpSetupFailure_n(bool rtcp);
156 void SignalDtlsSrtpSetupFailure_s(bool rtcp); 151 void SignalDtlsSrtpSetupFailure_s(bool rtcp);
157 152
158 // Used for latency measurements. 153 // Used for latency measurements.
159 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; 154 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived;
160 155
161 // Forward TransportChannel SignalSentPacket to worker thread. 156 // Forward TransportChannel SignalSentPacket to worker thread.
162 sigslot::signal1<const rtc::SentPacket&> SignalSentPacket; 157 sigslot::signal1<const rtc::SentPacket&> SignalSentPacket;
163 158
164 // Emitted whenever the rtcp-mux is active and the rtcp-transport can be 159 // Emitted whenever rtcp-mux is fully negotiated and the rtcp-transport can
165 // destroyed. 160 // be destroyed.
166 sigslot::signal1<const std::string&> SignalDestroyRtcpTransport; 161 // Fired on the network thread.
162 sigslot::signal1<const std::string&> SignalRtcpMuxFullyActive;
167 163
168 TransportChannel* rtp_transport() const { return rtp_transport_; } 164 TransportChannel* rtp_transport() const { return rtp_transport_; }
169 TransportChannel* rtcp_transport() const { return rtcp_transport_; } 165 TransportChannel* rtcp_transport() const { return rtcp_transport_; }
170 166
171 bool NeedsRtcpTransport(); 167 bool NeedsRtcpTransport();
172 168
173 // Made public for easier testing. 169 // Made public for easier testing.
174 // 170 //
175 // Updates "ready to send" for an individual channel, and informs the media 171 // Updates "ready to send" for an individual channel, and informs the media
176 // channel that the transport is ready to send if each channel (in use) is 172 // 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
328 void MaybeCacheRtpAbsSendTimeHeaderExtension_w( 324 void MaybeCacheRtpAbsSendTimeHeaderExtension_w(
329 const std::vector<webrtc::RtpExtension>& extensions); 325 const std::vector<webrtc::RtpExtension>& extensions);
330 326
331 bool CheckSrtpConfig_n(const std::vector<CryptoParams>& cryptos, 327 bool CheckSrtpConfig_n(const std::vector<CryptoParams>& cryptos,
332 bool* dtls, 328 bool* dtls,
333 std::string* error_desc); 329 std::string* error_desc);
334 bool SetSrtp_n(const std::vector<CryptoParams>& params, 330 bool SetSrtp_n(const std::vector<CryptoParams>& params,
335 ContentAction action, 331 ContentAction action,
336 ContentSource src, 332 ContentSource src,
337 std::string* error_desc); 333 std::string* error_desc);
338 void ActivateRtcpMux_n();
339 bool SetRtcpMux_n(bool enable, 334 bool SetRtcpMux_n(bool enable,
340 ContentAction action, 335 ContentAction action,
341 ContentSource src, 336 ContentSource src,
342 std::string* error_desc); 337 std::string* error_desc);
343 338
344 // From MessageHandler 339 // From MessageHandler
345 void OnMessage(rtc::Message* pmsg) override; 340 void OnMessage(rtc::Message* pmsg) override;
346 341
347 const rtc::CryptoOptions& crypto_options() const { 342 const rtc::CryptoOptions& crypto_options() const {
348 return crypto_options_; 343 return crypto_options_;
(...skipping 26 matching lines...) Expand all
375 370
376 rtc::Thread* const worker_thread_; 371 rtc::Thread* const worker_thread_;
377 rtc::Thread* const network_thread_; 372 rtc::Thread* const network_thread_;
378 rtc::Thread* const signaling_thread_; 373 rtc::Thread* const signaling_thread_;
379 rtc::AsyncInvoker invoker_; 374 rtc::AsyncInvoker invoker_;
380 375
381 const std::string content_name_; 376 const std::string content_name_;
382 std::unique_ptr<ConnectionMonitor> connection_monitor_; 377 std::unique_ptr<ConnectionMonitor> connection_monitor_;
383 378
384 std::string transport_name_; 379 std::string transport_name_;
385 // Is RTCP used at all by this type of channel? 380 // True if RTCP-multiplexing is required. In other words, no standalone RTCP
386 // Expected to be true (as of typing this) for everything except data 381 // transport will ever be used for this channel.
387 // channels. 382 const bool rtcp_mux_required_;
388 const bool rtcp_enabled_;
389 // TODO(johan): Replace TransportChannel* with rtc::PacketTransportInterface*. 383 // TODO(johan): Replace TransportChannel* with rtc::PacketTransportInterface*.
390 TransportChannel* rtp_transport_ = nullptr; 384 TransportChannel* rtp_transport_ = nullptr;
391 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; 385 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_;
392 TransportChannel* rtcp_transport_ = nullptr; 386 TransportChannel* rtcp_transport_ = nullptr;
393 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; 387 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_;
394 SrtpFilter srtp_filter_; 388 SrtpFilter srtp_filter_;
395 RtcpMuxFilter rtcp_mux_filter_; 389 RtcpMuxFilter rtcp_mux_filter_;
396 BundleFilter bundle_filter_; 390 BundleFilter bundle_filter_;
397 bool rtp_ready_to_send_ = false; 391 bool rtp_ready_to_send_ = false;
398 bool rtcp_ready_to_send_ = false; 392 bool rtcp_ready_to_send_ = false;
(...skipping 22 matching lines...) Expand all
421 // VoiceChannel is a specialization that adds support for early media, DTMF, 415 // VoiceChannel is a specialization that adds support for early media, DTMF,
422 // and input/output level monitoring. 416 // and input/output level monitoring.
423 class VoiceChannel : public BaseChannel { 417 class VoiceChannel : public BaseChannel {
424 public: 418 public:
425 VoiceChannel(rtc::Thread* worker_thread, 419 VoiceChannel(rtc::Thread* worker_thread,
426 rtc::Thread* network_thread, 420 rtc::Thread* network_thread,
427 rtc::Thread* signaling_thread, 421 rtc::Thread* signaling_thread,
428 MediaEngineInterface* media_engine, 422 MediaEngineInterface* media_engine,
429 VoiceMediaChannel* channel, 423 VoiceMediaChannel* channel,
430 const std::string& content_name, 424 const std::string& content_name,
431 bool rtcp, 425 bool rtcp_mux_required,
432 bool srtp_required); 426 bool srtp_required);
433 ~VoiceChannel(); 427 ~VoiceChannel();
434 bool Init_w(TransportChannel* rtp_transport, 428 bool Init_w(TransportChannel* rtp_transport,
435 TransportChannel* rtcp_transport); 429 TransportChannel* rtcp_transport);
436 430
437 // Configure sending media on the stream with SSRC |ssrc| 431 // Configure sending media on the stream with SSRC |ssrc|
438 // If there is only one sending stream SSRC 0 can be used. 432 // If there is only one sending stream SSRC 0 can be used.
439 bool SetAudioSend(uint32_t ssrc, 433 bool SetAudioSend(uint32_t ssrc,
440 bool enable, 434 bool enable,
441 const AudioOptions* options, 435 const AudioOptions* options,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 }; 534 };
541 535
542 // VideoChannel is a specialization for video. 536 // VideoChannel is a specialization for video.
543 class VideoChannel : public BaseChannel { 537 class VideoChannel : public BaseChannel {
544 public: 538 public:
545 VideoChannel(rtc::Thread* worker_thread, 539 VideoChannel(rtc::Thread* worker_thread,
546 rtc::Thread* network_thread, 540 rtc::Thread* network_thread,
547 rtc::Thread* signaling_thread, 541 rtc::Thread* signaling_thread,
548 VideoMediaChannel* channel, 542 VideoMediaChannel* channel,
549 const std::string& content_name, 543 const std::string& content_name,
550 bool rtcp, 544 bool rtcp_mux_required,
551 bool srtp_required); 545 bool srtp_required);
552 ~VideoChannel(); 546 ~VideoChannel();
553 bool Init_w(TransportChannel* rtp_transport, 547 bool Init_w(TransportChannel* rtp_transport,
554 TransportChannel* rtcp_transport); 548 TransportChannel* rtcp_transport);
555 549
556 // downcasts a MediaChannel 550 // downcasts a MediaChannel
557 VideoMediaChannel* media_channel() const override { 551 VideoMediaChannel* media_channel() const override {
558 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel()); 552 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel());
559 } 553 }
560 554
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 }; 614 };
621 615
622 // RtpDataChannel is a specialization for data. 616 // RtpDataChannel is a specialization for data.
623 class RtpDataChannel : public BaseChannel { 617 class RtpDataChannel : public BaseChannel {
624 public: 618 public:
625 RtpDataChannel(rtc::Thread* worker_thread, 619 RtpDataChannel(rtc::Thread* worker_thread,
626 rtc::Thread* network_thread, 620 rtc::Thread* network_thread,
627 rtc::Thread* signaling_thread, 621 rtc::Thread* signaling_thread,
628 DataMediaChannel* channel, 622 DataMediaChannel* channel,
629 const std::string& content_name, 623 const std::string& content_name,
630 bool rtcp, 624 bool rtcp_mux_required,
631 bool srtp_required); 625 bool srtp_required);
632 ~RtpDataChannel(); 626 ~RtpDataChannel();
633 bool Init_w(TransportChannel* rtp_transport, 627 bool Init_w(TransportChannel* rtp_transport,
634 TransportChannel* rtcp_transport); 628 TransportChannel* rtcp_transport);
635 629
636 virtual bool SendData(const SendDataParams& params, 630 virtual bool SendData(const SendDataParams& params,
637 const rtc::CopyOnWriteBuffer& payload, 631 const rtc::CopyOnWriteBuffer& payload,
638 SendDataResult* result); 632 SendDataResult* result);
639 633
640 void StartMediaMonitor(int cms); 634 void StartMediaMonitor(int cms);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 // SetSendParameters. 721 // SetSendParameters.
728 DataSendParameters last_send_params_; 722 DataSendParameters last_send_params_;
729 // Last DataRecvParameters sent down to the media_channel() via 723 // Last DataRecvParameters sent down to the media_channel() via
730 // SetRecvParameters. 724 // SetRecvParameters.
731 DataRecvParameters last_recv_params_; 725 DataRecvParameters last_recv_params_;
732 }; 726 };
733 727
734 } // namespace cricket 728 } // namespace cricket
735 729
736 #endif // WEBRTC_PC_CHANNEL_H_ 730 #endif // WEBRTC_PC_CHANNEL_H_
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsession.cc ('k') | webrtc/pc/channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698