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" | 14 #include "webrtc/api/ortc/rtptransportinterface.h" |
15 #include "webrtc/base/sigslot.h" | 15 #include "webrtc/base/sigslot.h" |
| 16 #include "webrtc/pc/bundlefilter.h" |
16 | 17 |
17 namespace rtc { | 18 namespace rtc { |
18 | 19 |
19 class CopyOnWriteBuffer; | 20 class CopyOnWriteBuffer; |
20 struct PacketOptions; | 21 struct PacketOptions; |
| 22 struct PacketTime; |
21 class PacketTransportInternal; | 23 class PacketTransportInternal; |
22 | 24 |
23 } // namespace rtc | 25 } // namespace rtc |
24 | 26 |
25 namespace webrtc { | 27 namespace webrtc { |
26 | 28 |
27 class RtpTransport : public RtpTransportInterface, public sigslot::has_slots<> { | 29 class RtpTransport : public RtpTransportInterface, public sigslot::has_slots<> { |
28 public: | 30 public: |
29 RtpTransport(const RtpTransport&) = delete; | 31 RtpTransport(const RtpTransport&) = delete; |
30 RtpTransport& operator=(const RtpTransport&) = delete; | 32 RtpTransport& operator=(const RtpTransport&) = delete; |
(...skipping 26 matching lines...) Expand all Loading... |
57 // than just "writable"; it means the last send didn't return ENOTCONN. | 59 // than just "writable"; it means the last send didn't return ENOTCONN. |
58 sigslot::signal1<bool> SignalReadyToSend; | 60 sigslot::signal1<bool> SignalReadyToSend; |
59 | 61 |
60 bool IsWritable(bool rtcp) const; | 62 bool IsWritable(bool rtcp) const; |
61 | 63 |
62 bool SendPacket(bool rtcp, | 64 bool SendPacket(bool rtcp, |
63 const rtc::CopyOnWriteBuffer* packet, | 65 const rtc::CopyOnWriteBuffer* packet, |
64 const rtc::PacketOptions& options, | 66 const rtc::PacketOptions& options, |
65 int flags); | 67 int flags); |
66 | 68 |
| 69 bool HandlesPayloadType(int payload_type) const; |
| 70 |
| 71 void AddHandledPayloadType(int payload_type); |
| 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 protected: | 79 protected: |
68 // TODO(zstein): Remove this when we remove RtpTransportAdapter. | 80 // TODO(zstein): Remove this when we remove RtpTransportAdapter. |
69 RtpTransportAdapter* GetInternal() override; | 81 RtpTransportAdapter* GetInternal() override; |
70 | 82 |
71 private: | 83 private: |
| 84 bool HandlesPacket(const uint8_t* data, size_t len); |
| 85 |
72 void OnReadyToSend(rtc::PacketTransportInternal* transport); | 86 void OnReadyToSend(rtc::PacketTransportInternal* transport); |
73 | 87 |
74 // Updates "ready to send" for an individual channel and fires | 88 // Updates "ready to send" for an individual channel and fires |
75 // SignalReadyToSend. | 89 // SignalReadyToSend. |
76 void SetReadyToSend(bool rtcp, bool ready); | 90 void SetReadyToSend(bool rtcp, bool ready); |
77 | 91 |
78 void MaybeSignalReadyToSend(); | 92 void MaybeSignalReadyToSend(); |
79 | 93 |
| 94 void OnReadPacket(rtc::PacketTransportInternal* transport, |
| 95 const char* data, |
| 96 size_t len, |
| 97 const rtc::PacketTime& packet_time, |
| 98 int flags); |
| 99 |
| 100 bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet); |
| 101 |
80 bool rtcp_mux_enabled_; | 102 bool rtcp_mux_enabled_; |
81 | 103 |
82 rtc::PacketTransportInternal* rtp_packet_transport_ = nullptr; | 104 rtc::PacketTransportInternal* rtp_packet_transport_ = nullptr; |
83 rtc::PacketTransportInternal* rtcp_packet_transport_ = nullptr; | 105 rtc::PacketTransportInternal* rtcp_packet_transport_ = nullptr; |
84 | 106 |
85 bool ready_to_send_ = false; | 107 bool ready_to_send_ = false; |
86 bool rtp_ready_to_send_ = false; | 108 bool rtp_ready_to_send_ = false; |
87 bool rtcp_ready_to_send_ = false; | 109 bool rtcp_ready_to_send_ = false; |
88 | 110 |
89 RtcpParameters rtcp_parameters_; | 111 RtcpParameters rtcp_parameters_; |
| 112 |
| 113 cricket::BundleFilter bundle_filter_; |
90 }; | 114 }; |
91 | 115 |
92 } // namespace webrtc | 116 } // namespace webrtc |
93 | 117 |
94 #endif // WEBRTC_PC_RTPTRANSPORT_H_ | 118 #endif // WEBRTC_PC_RTPTRANSPORT_H_ |
OLD | NEW |