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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 send_bitrate(0), | 84 send_bitrate(0), |
85 last_rr_ntp_secs(0), | 85 last_rr_ntp_secs(0), |
86 last_rr_ntp_frac(0), | 86 last_rr_ntp_frac(0), |
87 remote_sr(0), | 87 remote_sr(0), |
88 has_last_xr_rr(false), | 88 has_last_xr_rr(false), |
89 module(nullptr) {} | 89 module(nullptr) {} |
90 | 90 |
91 class PacketContainer : public rtcp::CompoundPacket, | 91 class PacketContainer : public rtcp::CompoundPacket, |
92 public rtcp::RtcpPacket::PacketReadyCallback { | 92 public rtcp::RtcpPacket::PacketReadyCallback { |
93 public: | 93 public: |
94 PacketContainer(Transport* transport, RtcEventLog* event_log) | 94 PacketContainer(Transport* transport, RtcEventLogProxy* event_log) |
95 : transport_(transport), event_log_(event_log), bytes_sent_(0) {} | 95 : transport_(transport), event_log_(event_log), bytes_sent_(0) {} |
96 virtual ~PacketContainer() { | 96 virtual ~PacketContainer() { |
97 for (RtcpPacket* packet : appended_packets_) | 97 for (RtcpPacket* packet : appended_packets_) |
98 delete packet; | 98 delete packet; |
99 } | 99 } |
100 | 100 |
101 void OnPacketReady(uint8_t* data, size_t length) override { | 101 void OnPacketReady(uint8_t* data, size_t length) override { |
102 if (transport_->SendRtcp(data, length)) { | 102 if (transport_->SendRtcp(data, length)) { |
103 bytes_sent_ += length; | 103 bytes_sent_ += length; |
104 if (event_log_) { | 104 if (event_log_) { |
105 event_log_->LogRtcpPacket(kOutgoingPacket, MediaType::ANY, data, | 105 event_log_->LogRtcpPacket(kOutgoingPacket, MediaType::ANY, data, |
106 length); | 106 length); |
107 } | 107 } |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 size_t SendPackets() { | 111 size_t SendPackets() { |
112 rtcp::CompoundPacket::Build(this); | 112 rtcp::CompoundPacket::Build(this); |
113 return bytes_sent_; | 113 return bytes_sent_; |
114 } | 114 } |
115 | 115 |
116 private: | 116 private: |
117 Transport* transport_; | 117 Transport* transport_; |
118 RtcEventLog* const event_log_; | 118 RtcEventLogProxy* const event_log_; |
119 size_t bytes_sent_; | 119 size_t bytes_sent_; |
120 | 120 |
121 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(PacketContainer); | 121 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(PacketContainer); |
122 }; | 122 }; |
123 | 123 |
124 class RTCPSender::RtcpContext { | 124 class RTCPSender::RtcpContext { |
125 public: | 125 public: |
126 RtcpContext(const FeedbackState& feedback_state, | 126 RtcpContext(const FeedbackState& feedback_state, |
127 int32_t nack_size, | 127 int32_t nack_size, |
128 const uint16_t* nack_list, | 128 const uint16_t* nack_list, |
(...skipping 22 matching lines...) Expand all Loading... |
151 const uint32_t ntp_frac_; | 151 const uint32_t ntp_frac_; |
152 | 152 |
153 PacketContainer* const container_; | 153 PacketContainer* const container_; |
154 }; | 154 }; |
155 | 155 |
156 RTCPSender::RTCPSender( | 156 RTCPSender::RTCPSender( |
157 bool audio, | 157 bool audio, |
158 Clock* clock, | 158 Clock* clock, |
159 ReceiveStatistics* receive_statistics, | 159 ReceiveStatistics* receive_statistics, |
160 RtcpPacketTypeCounterObserver* packet_type_counter_observer, | 160 RtcpPacketTypeCounterObserver* packet_type_counter_observer, |
161 RtcEventLog* event_log, | 161 RtcEventLogProxy* event_log, |
162 Transport* outgoing_transport) | 162 Transport* outgoing_transport) |
163 : audio_(audio), | 163 : audio_(audio), |
164 clock_(clock), | 164 clock_(clock), |
165 random_(clock_->TimeInMicroseconds()), | 165 random_(clock_->TimeInMicroseconds()), |
166 method_(RtcpMode::kOff), | 166 method_(RtcpMode::kOff), |
167 event_log_(event_log), | 167 event_log_(event_log), |
168 transport_(outgoing_transport), | 168 transport_(outgoing_transport), |
169 | 169 |
170 critical_section_rtcp_sender_( | 170 critical_section_rtcp_sender_( |
171 CriticalSectionWrapper::CreateCriticalSection()), | 171 CriticalSectionWrapper::CreateCriticalSection()), |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 for (const ReportFlag& flag : report_flags_) { | 1019 for (const ReportFlag& flag : report_flags_) { |
1020 if (flag.is_volatile) | 1020 if (flag.is_volatile) |
1021 return false; | 1021 return false; |
1022 } | 1022 } |
1023 return true; | 1023 return true; |
1024 } | 1024 } |
1025 | 1025 |
1026 bool RTCPSender::SendFeedbackPacket(const rtcp::TransportFeedback& packet) { | 1026 bool RTCPSender::SendFeedbackPacket(const rtcp::TransportFeedback& packet) { |
1027 class Sender : public rtcp::RtcpPacket::PacketReadyCallback { | 1027 class Sender : public rtcp::RtcpPacket::PacketReadyCallback { |
1028 public: | 1028 public: |
1029 Sender(Transport* transport, RtcEventLog* event_log) | 1029 Sender(Transport* transport, RtcEventLogProxy* event_log) |
1030 : transport_(transport), event_log_(event_log), send_failure_(false) {} | 1030 : transport_(transport), event_log_(event_log), send_failure_(false) {} |
1031 | 1031 |
1032 void OnPacketReady(uint8_t* data, size_t length) override { | 1032 void OnPacketReady(uint8_t* data, size_t length) override { |
1033 if (transport_->SendRtcp(data, length)) { | 1033 if (transport_->SendRtcp(data, length)) { |
1034 if (event_log_) { | 1034 if (event_log_) { |
1035 event_log_->LogRtcpPacket(kOutgoingPacket, MediaType::ANY, data, | 1035 event_log_->LogRtcpPacket(kOutgoingPacket, MediaType::ANY, data, |
1036 length); | 1036 length); |
1037 } | 1037 } |
1038 } else { | 1038 } else { |
1039 send_failure_ = true; | 1039 send_failure_ = true; |
1040 } | 1040 } |
1041 } | 1041 } |
1042 | 1042 |
1043 Transport* const transport_; | 1043 Transport* const transport_; |
1044 RtcEventLog* const event_log_; | 1044 RtcEventLogProxy* const event_log_; |
1045 bool send_failure_; | 1045 bool send_failure_; |
1046 // TODO(terelius): We would like to | 1046 // TODO(terelius): We would like to |
1047 // RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Sender); | 1047 // RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Sender); |
1048 // but we can't because of an incorrect warning (C4822) in MVS 2013. | 1048 // but we can't because of an incorrect warning (C4822) in MVS 2013. |
1049 } sender(transport_, event_log_); | 1049 } sender(transport_, event_log_); |
1050 | 1050 |
1051 uint8_t buffer[IP_PACKET_SIZE]; | 1051 uint8_t buffer[IP_PACKET_SIZE]; |
1052 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && | 1052 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && |
1053 !sender.send_failure_; | 1053 !sender.send_failure_; |
1054 } | 1054 } |
1055 | |
1056 } // namespace webrtc | 1055 } // namespace webrtc |
OLD | NEW |