| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 : transport_(transport), event_log_(event_log), bytes_sent_(0) {} | 92 : transport_(transport), event_log_(event_log), bytes_sent_(0) {} |
| 93 virtual ~PacketContainer() { | 93 virtual ~PacketContainer() { |
| 94 for (RtcpPacket* packet : appended_packets_) | 94 for (RtcpPacket* packet : appended_packets_) |
| 95 delete packet; | 95 delete packet; |
| 96 } | 96 } |
| 97 | 97 |
| 98 void OnPacketReady(uint8_t* data, size_t length) override { | 98 void OnPacketReady(uint8_t* data, size_t length) override { |
| 99 if (transport_->SendRtcp(data, length)) { | 99 if (transport_->SendRtcp(data, length)) { |
| 100 bytes_sent_ += length; | 100 bytes_sent_ += length; |
| 101 if (event_log_) { | 101 if (event_log_) { |
| 102 event_log_->LogRtcpPacket(kOutgoingPacket, data, length); | 102 event_log_->LogOutgoingRtcpPacket( |
| 103 rtc::ArrayView<const uint8_t>(data, length)); |
| 103 } | 104 } |
| 104 } | 105 } |
| 105 } | 106 } |
| 106 | 107 |
| 107 size_t SendPackets(size_t max_payload_length) { | 108 size_t SendPackets(size_t max_payload_length) { |
| 108 RTC_DCHECK_LE(max_payload_length, IP_PACKET_SIZE); | 109 RTC_DCHECK_LE(max_payload_length, IP_PACKET_SIZE); |
| 109 uint8_t buffer[IP_PACKET_SIZE]; | 110 uint8_t buffer[IP_PACKET_SIZE]; |
| 110 BuildExternalBuffer(buffer, max_payload_length, this); | 111 BuildExternalBuffer(buffer, max_payload_length, this); |
| 111 return bytes_sent_; | 112 return bytes_sent_; |
| 112 } | 113 } |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 | 956 |
| 956 bool RTCPSender::SendFeedbackPacket(const rtcp::TransportFeedback& packet) { | 957 bool RTCPSender::SendFeedbackPacket(const rtcp::TransportFeedback& packet) { |
| 957 class Sender : public rtcp::RtcpPacket::PacketReadyCallback { | 958 class Sender : public rtcp::RtcpPacket::PacketReadyCallback { |
| 958 public: | 959 public: |
| 959 Sender(Transport* transport, RtcEventLog* event_log) | 960 Sender(Transport* transport, RtcEventLog* event_log) |
| 960 : transport_(transport), event_log_(event_log), send_failure_(false) {} | 961 : transport_(transport), event_log_(event_log), send_failure_(false) {} |
| 961 | 962 |
| 962 void OnPacketReady(uint8_t* data, size_t length) override { | 963 void OnPacketReady(uint8_t* data, size_t length) override { |
| 963 if (transport_->SendRtcp(data, length)) { | 964 if (transport_->SendRtcp(data, length)) { |
| 964 if (event_log_) { | 965 if (event_log_) { |
| 965 event_log_->LogRtcpPacket(kOutgoingPacket, data, length); | 966 event_log_->LogOutgoingRtcpPacket( |
| 967 rtc::ArrayView<const uint8_t>(data, length)); |
| 966 } | 968 } |
| 967 } else { | 969 } else { |
| 968 send_failure_ = true; | 970 send_failure_ = true; |
| 969 } | 971 } |
| 970 } | 972 } |
| 971 | 973 |
| 972 Transport* const transport_; | 974 Transport* const transport_; |
| 973 RtcEventLog* const event_log_; | 975 RtcEventLog* const event_log_; |
| 974 bool send_failure_; | 976 bool send_failure_; |
| 975 // TODO(terelius): We would like to | 977 // TODO(terelius): We would like to |
| 976 // RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Sender); | 978 // RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Sender); |
| 977 // but we can't because of an incorrect warning (C4822) in MVS 2013. | 979 // but we can't because of an incorrect warning (C4822) in MVS 2013. |
| 978 } sender(transport_, event_log_); | 980 } sender(transport_, event_log_); |
| 979 | 981 |
| 980 size_t max_packet_size; | 982 size_t max_packet_size; |
| 981 { | 983 { |
| 982 rtc::CritScope lock(&critical_section_rtcp_sender_); | 984 rtc::CritScope lock(&critical_section_rtcp_sender_); |
| 983 if (method_ == RtcpMode::kOff) | 985 if (method_ == RtcpMode::kOff) |
| 984 return false; | 986 return false; |
| 985 max_packet_size = max_packet_size_; | 987 max_packet_size = max_packet_size_; |
| 986 } | 988 } |
| 987 | 989 |
| 988 RTC_DCHECK_LE(max_packet_size, IP_PACKET_SIZE); | 990 RTC_DCHECK_LE(max_packet_size, IP_PACKET_SIZE); |
| 989 uint8_t buffer[IP_PACKET_SIZE]; | 991 uint8_t buffer[IP_PACKET_SIZE]; |
| 990 return packet.BuildExternalBuffer(buffer, max_packet_size, &sender) && | 992 return packet.BuildExternalBuffer(buffer, max_packet_size, &sender) && |
| 991 !sender.send_failure_; | 993 !sender.send_failure_; |
| 992 } | 994 } |
| 993 | 995 |
| 994 } // namespace webrtc | 996 } // namespace webrtc |
| OLD | NEW |