OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 : transport_(transport), event_log_(event_log), bytes_sent_(0) {} | 93 : transport_(transport), event_log_(event_log), bytes_sent_(0) {} |
94 virtual ~PacketContainer() { | 94 virtual ~PacketContainer() { |
95 for (RtcpPacket* packet : appended_packets_) | 95 for (RtcpPacket* packet : appended_packets_) |
96 delete packet; | 96 delete packet; |
97 } | 97 } |
98 | 98 |
99 void OnPacketReady(uint8_t* data, size_t length) override { | 99 void OnPacketReady(uint8_t* data, size_t length) override { |
100 if (transport_->SendRtcp(data, length)) { | 100 if (transport_->SendRtcp(data, length)) { |
101 bytes_sent_ += length; | 101 bytes_sent_ += length; |
102 if (event_log_) { | 102 if (event_log_) { |
103 event_log_->LogRtcpPacket(kOutgoingPacket, MediaType::ANY, data, | 103 event_log_->LogRtcpPacket(kOutgoingPacket, data, length); |
104 length); | |
105 } | 104 } |
106 } | 105 } |
107 } | 106 } |
108 | 107 |
109 size_t SendPackets(size_t max_payload_length) { | 108 size_t SendPackets(size_t max_payload_length) { |
110 RTC_DCHECK_LE(max_payload_length, IP_PACKET_SIZE); | 109 RTC_DCHECK_LE(max_payload_length, IP_PACKET_SIZE); |
111 uint8_t buffer[IP_PACKET_SIZE]; | 110 uint8_t buffer[IP_PACKET_SIZE]; |
112 BuildExternalBuffer(buffer, max_payload_length, this); | 111 BuildExternalBuffer(buffer, max_payload_length, this); |
113 return bytes_sent_; | 112 return bytes_sent_; |
114 } | 113 } |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 | 979 |
981 bool RTCPSender::SendFeedbackPacket(const rtcp::TransportFeedback& packet) { | 980 bool RTCPSender::SendFeedbackPacket(const rtcp::TransportFeedback& packet) { |
982 class Sender : public rtcp::RtcpPacket::PacketReadyCallback { | 981 class Sender : public rtcp::RtcpPacket::PacketReadyCallback { |
983 public: | 982 public: |
984 Sender(Transport* transport, RtcEventLog* event_log) | 983 Sender(Transport* transport, RtcEventLog* event_log) |
985 : transport_(transport), event_log_(event_log), send_failure_(false) {} | 984 : transport_(transport), event_log_(event_log), send_failure_(false) {} |
986 | 985 |
987 void OnPacketReady(uint8_t* data, size_t length) override { | 986 void OnPacketReady(uint8_t* data, size_t length) override { |
988 if (transport_->SendRtcp(data, length)) { | 987 if (transport_->SendRtcp(data, length)) { |
989 if (event_log_) { | 988 if (event_log_) { |
990 event_log_->LogRtcpPacket(kOutgoingPacket, MediaType::ANY, data, | 989 event_log_->LogRtcpPacket(kOutgoingPacket, data, length); |
991 length); | |
992 } | 990 } |
993 } else { | 991 } else { |
994 send_failure_ = true; | 992 send_failure_ = true; |
995 } | 993 } |
996 } | 994 } |
997 | 995 |
998 Transport* const transport_; | 996 Transport* const transport_; |
999 RtcEventLog* const event_log_; | 997 RtcEventLog* const event_log_; |
1000 bool send_failure_; | 998 bool send_failure_; |
1001 // TODO(terelius): We would like to | 999 // TODO(terelius): We would like to |
1002 // RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Sender); | 1000 // RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Sender); |
1003 // but we can't because of an incorrect warning (C4822) in MVS 2013. | 1001 // but we can't because of an incorrect warning (C4822) in MVS 2013. |
1004 } sender(transport_, event_log_); | 1002 } sender(transport_, event_log_); |
1005 | 1003 |
1006 size_t max_packet_size; | 1004 size_t max_packet_size; |
1007 { | 1005 { |
1008 rtc::CritScope lock(&critical_section_rtcp_sender_); | 1006 rtc::CritScope lock(&critical_section_rtcp_sender_); |
1009 if (method_ == RtcpMode::kOff) | 1007 if (method_ == RtcpMode::kOff) |
1010 return false; | 1008 return false; |
1011 max_packet_size = max_packet_size_; | 1009 max_packet_size = max_packet_size_; |
1012 } | 1010 } |
1013 | 1011 |
1014 RTC_DCHECK_LE(max_packet_size, IP_PACKET_SIZE); | 1012 RTC_DCHECK_LE(max_packet_size, IP_PACKET_SIZE); |
1015 uint8_t buffer[IP_PACKET_SIZE]; | 1013 uint8_t buffer[IP_PACKET_SIZE]; |
1016 return packet.BuildExternalBuffer(buffer, max_packet_size, &sender) && | 1014 return packet.BuildExternalBuffer(buffer, max_packet_size, &sender) && |
1017 !sender.send_failure_; | 1015 !sender.send_failure_; |
1018 } | 1016 } |
1019 | 1017 |
1020 } // namespace webrtc | 1018 } // namespace webrtc |
OLD | NEW |