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

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

Issue 2812243005: Move ready to send logic from BaseChannel to RtpTransport. (Closed)
Patch Set: Remove dcheck that does not currently hold. Created 3 years, 8 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/pc/channel_unittest.cc ('k') | webrtc/pc/rtptransport.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 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_RTPTRANSPORT_H_ 11 #ifndef WEBRTC_PC_RTPTRANSPORT_H_
12 #define WEBRTC_PC_RTPTRANSPORT_H_ 12 #define WEBRTC_PC_RTPTRANSPORT_H_
13 13
14 #include "webrtc/api/ortc/rtptransportinterface.h" 14 #include "webrtc/api/ortc/rtptransportinterface.h"
15 #include "webrtc/base/sigslot.h"
15 16
16 namespace rtc { 17 namespace rtc {
17 18
19 class CopyOnWriteBuffer;
20 struct PacketOptions;
18 class PacketTransportInternal; 21 class PacketTransportInternal;
19 22
20 } // namespace rtc 23 } // namespace rtc
21 24
22 namespace webrtc { 25 namespace webrtc {
23 26
24 class RtpTransport : public RtpTransportInterface { 27 class RtpTransport : public RtpTransportInterface, public sigslot::has_slots<> {
25 public: 28 public:
26 RtpTransport(const RtpTransport&) = delete; 29 RtpTransport(const RtpTransport&) = delete;
27 RtpTransport& operator=(const RtpTransport&) = delete; 30 RtpTransport& operator=(const RtpTransport&) = delete;
28 31
29 explicit RtpTransport(bool rtcp_mux_required) 32 explicit RtpTransport(bool rtcp_mux_enabled)
30 : rtcp_mux_required_(rtcp_mux_required) {} 33 : rtcp_mux_enabled_(rtcp_mux_enabled) {}
31 34
32 bool rtcp_mux_required() const { return rtcp_mux_required_; } 35 bool rtcp_mux_enabled() const { return rtcp_mux_enabled_; }
36 void SetRtcpMuxEnabled(bool enable);
33 37
34 rtc::PacketTransportInternal* rtp_packet_transport() const { 38 rtc::PacketTransportInternal* rtp_packet_transport() const {
35 return rtp_packet_transport_; 39 return rtp_packet_transport_;
36 } 40 }
37 void set_rtp_packet_transport(rtc::PacketTransportInternal* rtp); 41 void SetRtpPacketTransport(rtc::PacketTransportInternal* rtp);
38 42
39 rtc::PacketTransportInternal* rtcp_packet_transport() const { 43 rtc::PacketTransportInternal* rtcp_packet_transport() const {
40 return rtcp_packet_transport_; 44 return rtcp_packet_transport_;
41 } 45 }
42 void set_rtcp_packet_transport(rtc::PacketTransportInternal* rtcp); 46 void SetRtcpPacketTransport(rtc::PacketTransportInternal* rtcp);
43 47
44 PacketTransportInterface* GetRtpPacketTransport() const override; 48 PacketTransportInterface* GetRtpPacketTransport() const override;
45 PacketTransportInterface* GetRtcpPacketTransport() const override; 49 PacketTransportInterface* GetRtcpPacketTransport() const override;
46 50
47 // TODO(zstein): Use these RtcpParameters for configuration elsewhere. 51 // TODO(zstein): Use these RtcpParameters for configuration elsewhere.
48 RTCError SetRtcpParameters(const RtcpParameters& parameters) override; 52 RTCError SetRtcpParameters(const RtcpParameters& parameters) override;
49 RtcpParameters GetRtcpParameters() const override; 53 RtcpParameters GetRtcpParameters() const override;
50 54
55 // Called whenever a transport's ready-to-send state changes. The argument
56 // is true if all used transports are ready to send. This is more specific
57 // than just "writable"; it means the last send didn't return ENOTCONN.
58 sigslot::signal1<bool> SignalReadyToSend;
59
60 bool IsWritable(bool rtcp) const;
61
62 bool SendPacket(bool rtcp,
63 const rtc::CopyOnWriteBuffer* packet,
64 const rtc::PacketOptions& options,
65 int flags);
66
51 protected: 67 protected:
52 // TODO(zstein): Remove this when we remove RtpTransportAdapter. 68 // TODO(zstein): Remove this when we remove RtpTransportAdapter.
53 RtpTransportAdapter* GetInternal() override; 69 RtpTransportAdapter* GetInternal() override;
54 70
55 private: 71 private:
56 // True if RTCP-multiplexing is required. rtcp_packet_transport_ should 72 void OnReadyToSend(rtc::PacketTransportInternal* transport);
57 // always be null in this case. 73
58 const bool rtcp_mux_required_; 74 // Updates "ready to send" for an individual channel and fires
75 // SignalReadyToSend.
76 void SetReadyToSend(bool rtcp, bool ready);
77
78 void MaybeSignalReadyToSend();
79
80 bool rtcp_mux_enabled_;
59 81
60 rtc::PacketTransportInternal* rtp_packet_transport_ = nullptr; 82 rtc::PacketTransportInternal* rtp_packet_transport_ = nullptr;
61 rtc::PacketTransportInternal* rtcp_packet_transport_ = nullptr; 83 rtc::PacketTransportInternal* rtcp_packet_transport_ = nullptr;
62 84
85 bool ready_to_send_ = false;
86 bool rtp_ready_to_send_ = false;
87 bool rtcp_ready_to_send_ = false;
88
63 RtcpParameters rtcp_parameters_; 89 RtcpParameters rtcp_parameters_;
64 }; 90 };
65 91
66 } // namespace webrtc 92 } // namespace webrtc
67 93
68 #endif // WEBRTC_PC_RTPTRANSPORT_H_ 94 #endif // WEBRTC_PC_RTPTRANSPORT_H_
OLDNEW
« no previous file with comments | « webrtc/pc/channel_unittest.cc ('k') | webrtc/pc/rtptransport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698