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 |
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" | |
15 #include "webrtc/pc/bundlefilter.h" | 14 #include "webrtc/pc/bundlefilter.h" |
| 15 #include "webrtc/pc/rtptransportinternal.h" |
16 #include "webrtc/rtc_base/sigslot.h" | 16 #include "webrtc/rtc_base/sigslot.h" |
17 | 17 |
18 namespace rtc { | 18 namespace rtc { |
19 | 19 |
20 class CopyOnWriteBuffer; | 20 class CopyOnWriteBuffer; |
21 struct PacketOptions; | 21 struct PacketOptions; |
22 struct PacketTime; | 22 struct PacketTime; |
23 class PacketTransportInternal; | 23 class PacketTransportInternal; |
24 | 24 |
25 } // namespace rtc | 25 } // namespace rtc |
26 | 26 |
27 namespace webrtc { | 27 namespace webrtc { |
28 | 28 |
29 class RtpTransport : public RtpTransportInterface, public sigslot::has_slots<> { | 29 class RtpTransport : public RtpTransportInternal { |
30 public: | 30 public: |
31 RtpTransport(const RtpTransport&) = delete; | 31 RtpTransport(const RtpTransport&) = delete; |
32 RtpTransport& operator=(const RtpTransport&) = delete; | 32 RtpTransport& operator=(const RtpTransport&) = delete; |
33 | 33 |
34 explicit RtpTransport(bool rtcp_mux_enabled) | 34 explicit RtpTransport(bool rtcp_mux_enabled) |
35 : rtcp_mux_enabled_(rtcp_mux_enabled) {} | 35 : rtcp_mux_enabled_(rtcp_mux_enabled) {} |
36 | 36 |
37 bool rtcp_mux_enabled() const { return rtcp_mux_enabled_; } | 37 bool rtcp_mux_enabled() const { return rtcp_mux_enabled_; } |
38 void SetRtcpMuxEnabled(bool enable); | 38 void SetRtcpMuxEnabled(bool enable) override; |
39 | 39 |
40 rtc::PacketTransportInternal* rtp_packet_transport() const { | 40 rtc::PacketTransportInternal* rtp_packet_transport() const override { |
41 return rtp_packet_transport_; | 41 return rtp_packet_transport_; |
42 } | 42 } |
43 void SetRtpPacketTransport(rtc::PacketTransportInternal* rtp); | 43 void SetRtpPacketTransport(rtc::PacketTransportInternal* rtp) override; |
44 | 44 |
45 rtc::PacketTransportInternal* rtcp_packet_transport() const { | 45 rtc::PacketTransportInternal* rtcp_packet_transport() const override { |
46 return rtcp_packet_transport_; | 46 return rtcp_packet_transport_; |
47 } | 47 } |
48 void SetRtcpPacketTransport(rtc::PacketTransportInternal* rtcp); | 48 void SetRtcpPacketTransport(rtc::PacketTransportInternal* rtcp) override; |
49 | 49 |
50 PacketTransportInterface* GetRtpPacketTransport() const override; | 50 PacketTransportInterface* GetRtpPacketTransport() const override; |
51 PacketTransportInterface* GetRtcpPacketTransport() const override; | 51 PacketTransportInterface* GetRtcpPacketTransport() const override; |
52 | 52 |
53 // TODO(zstein): Use these RtcpParameters for configuration elsewhere. | 53 // TODO(zstein): Use these RtcpParameters for configuration elsewhere. |
54 RTCError SetRtcpParameters(const RtcpParameters& parameters) override; | 54 RTCError SetRtcpParameters(const RtcpParameters& parameters) override; |
55 RtcpParameters GetRtcpParameters() const override; | 55 RtcpParameters GetRtcpParameters() const override; |
56 | 56 |
57 // Called whenever a transport's ready-to-send state changes. The argument | 57 bool IsWritable(bool rtcp) const override; |
58 // is true if all used transports are ready to send. This is more specific | |
59 // than just "writable"; it means the last send didn't return ENOTCONN. | |
60 sigslot::signal1<bool> SignalReadyToSend; | |
61 | |
62 bool IsWritable(bool rtcp) const; | |
63 | 58 |
64 bool SendPacket(bool rtcp, | 59 bool SendPacket(bool rtcp, |
65 const rtc::CopyOnWriteBuffer* packet, | 60 rtc::CopyOnWriteBuffer* packet, |
66 const rtc::PacketOptions& options, | 61 const rtc::PacketOptions& options, |
67 int flags); | 62 int flags) override; |
68 | 63 |
69 bool HandlesPayloadType(int payload_type) const; | 64 bool HandlesPayloadType(int payload_type) const override; |
70 | 65 |
71 void AddHandledPayloadType(int payload_type); | 66 void AddHandledPayloadType(int payload_type) override; |
72 | |
73 // TODO(zstein): Consider having two signals - RtcPacketReceived and | |
74 // RtcpPacketReceived. | |
75 // The first argument is true for RTCP packets and false for RTP packets. | |
76 sigslot::signal3<bool, rtc::CopyOnWriteBuffer*, const rtc::PacketTime&> | |
77 SignalPacketReceived; | |
78 | 67 |
79 protected: | 68 protected: |
80 // TODO(zstein): Remove this when we remove RtpTransportAdapter. | 69 // TODO(zstein): Remove this when we remove RtpTransportAdapter. |
81 RtpTransportAdapter* GetInternal() override; | 70 RtpTransportAdapter* GetInternal() override; |
82 | 71 |
83 private: | 72 private: |
84 bool HandlesPacket(const uint8_t* data, size_t len); | 73 bool HandlesPacket(const uint8_t* data, size_t len); |
85 | 74 |
86 void OnReadyToSend(rtc::PacketTransportInternal* transport); | 75 void OnReadyToSend(rtc::PacketTransportInternal* transport); |
87 | 76 |
(...skipping 21 matching lines...) Expand all Loading... |
109 bool rtcp_ready_to_send_ = false; | 98 bool rtcp_ready_to_send_ = false; |
110 | 99 |
111 RtcpParameters rtcp_parameters_; | 100 RtcpParameters rtcp_parameters_; |
112 | 101 |
113 cricket::BundleFilter bundle_filter_; | 102 cricket::BundleFilter bundle_filter_; |
114 }; | 103 }; |
115 | 104 |
116 } // namespace webrtc | 105 } // namespace webrtc |
117 | 106 |
118 #endif // WEBRTC_PC_RTPTRANSPORT_H_ | 107 #endif // WEBRTC_PC_RTPTRANSPORT_H_ |
OLD | NEW |