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 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 rtcp_packet_transport_ && rtcp_packet_transport_->writable()); | 69 rtcp_packet_transport_ && rtcp_packet_transport_->writable()); |
70 } | 70 } |
71 | 71 |
72 bool RtpTransport::IsWritable(bool rtcp) const { | 72 bool RtpTransport::IsWritable(bool rtcp) const { |
73 rtc::PacketTransportInternal* transport = rtcp && !rtcp_mux_enabled_ | 73 rtc::PacketTransportInternal* transport = rtcp && !rtcp_mux_enabled_ |
74 ? rtcp_packet_transport_ | 74 ? rtcp_packet_transport_ |
75 : rtp_packet_transport_; | 75 : rtp_packet_transport_; |
76 return transport && transport->writable(); | 76 return transport && transport->writable(); |
77 } | 77 } |
78 | 78 |
79 bool RtpTransport::SendRtpPacket(rtc::CopyOnWriteBuffer* packet, | |
80 const rtc::PacketOptions& options, | |
81 int flags) { | |
82 return SendPacket(false, packet, options, flags); | |
83 } | |
84 | |
85 bool RtpTransport::SendRtcpPacket(rtc::CopyOnWriteBuffer* packet, | |
86 const rtc::PacketOptions& options, | |
87 int flags) { | |
88 return SendPacket(true, packet, options, flags); | |
89 } | |
90 | |
91 bool RtpTransport::SendPacket(bool rtcp, | 79 bool RtpTransport::SendPacket(bool rtcp, |
92 rtc::CopyOnWriteBuffer* packet, | 80 rtc::CopyOnWriteBuffer* packet, |
93 const rtc::PacketOptions& options, | 81 const rtc::PacketOptions& options, |
94 int flags) { | 82 int flags) { |
95 rtc::PacketTransportInternal* transport = rtcp && !rtcp_mux_enabled_ | 83 rtc::PacketTransportInternal* transport = rtcp && !rtcp_mux_enabled_ |
96 ? rtcp_packet_transport_ | 84 ? rtcp_packet_transport_ |
97 : rtp_packet_transport_; | 85 : rtp_packet_transport_; |
98 int ret = transport->SendPacket(packet->data<char>(), packet->size(), options, | 86 int ret = transport->SendPacket(packet->data<char>(), packet->size(), options, |
99 flags); | 87 flags); |
100 if (ret != static_cast<int>(packet->size())) { | 88 if (ret != static_cast<int>(packet->size())) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 209 } |
222 if (rtcp) { | 210 if (rtcp) { |
223 // Permit all (seemingly valid) RTCP packets. | 211 // Permit all (seemingly valid) RTCP packets. |
224 return true; | 212 return true; |
225 } | 213 } |
226 // Check whether we handle this payload. | 214 // Check whether we handle this payload. |
227 return HandlesPacket(packet->data(), packet->size()); | 215 return HandlesPacket(packet->data(), packet->size()); |
228 } | 216 } |
229 | 217 |
230 } // namespace webrtc | 218 } // namespace webrtc |
OLD | NEW |