OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 voip_metric_block_.emplace(voip_metric); | 111 voip_metric_block_.emplace(voip_metric); |
112 } | 112 } |
113 | 113 |
114 void ExtendedReports::SetTargetBitrate(const TargetBitrate& bitrate) { | 114 void ExtendedReports::SetTargetBitrate(const TargetBitrate& bitrate) { |
115 if (target_bitrate_) | 115 if (target_bitrate_) |
116 LOG(LS_WARNING) << "TargetBitrate already set, overwriting."; | 116 LOG(LS_WARNING) << "TargetBitrate already set, overwriting."; |
117 | 117 |
118 target_bitrate_ = rtc::Optional<TargetBitrate>(bitrate); | 118 target_bitrate_ = rtc::Optional<TargetBitrate>(bitrate); |
119 } | 119 } |
120 | 120 |
| 121 size_t ExtendedReports::BlockLength() const { |
| 122 return kHeaderLength + kXrBaseLength + RrtrLength() + DlrrLength() + |
| 123 VoipMetricLength() + TargetBitrateLength(); |
| 124 } |
| 125 |
121 bool ExtendedReports::Create(uint8_t* packet, | 126 bool ExtendedReports::Create(uint8_t* packet, |
122 size_t* index, | 127 size_t* index, |
123 size_t max_length, | 128 size_t max_length, |
124 RtcpPacket::PacketReadyCallback* callback) const { | 129 RtcpPacket::PacketReadyCallback* callback) const { |
125 while (*index + BlockLength() > max_length) { | 130 while (*index + BlockLength() > max_length) { |
126 if (!OnBufferFull(packet, index, callback)) | 131 if (!OnBufferFull(packet, index, callback)) |
127 return false; | 132 return false; |
128 } | 133 } |
129 size_t index_end = *index + BlockLength(); | 134 size_t index_end = *index + BlockLength(); |
130 const uint8_t kReserved = 0; | 135 const uint8_t kReserved = 0; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 } | 203 } |
199 | 204 |
200 void ExtendedReports::ParseTargetBitrateBlock(const uint8_t* block, | 205 void ExtendedReports::ParseTargetBitrateBlock(const uint8_t* block, |
201 uint16_t block_length) { | 206 uint16_t block_length) { |
202 target_bitrate_ = rtc::Optional<TargetBitrate>(TargetBitrate()); | 207 target_bitrate_ = rtc::Optional<TargetBitrate>(TargetBitrate()); |
203 if (!target_bitrate_->Parse(block, block_length)) | 208 if (!target_bitrate_->Parse(block, block_length)) |
204 target_bitrate_ = rtc::Optional<TargetBitrate>(); | 209 target_bitrate_ = rtc::Optional<TargetBitrate>(); |
205 } | 210 } |
206 } // namespace rtcp | 211 } // namespace rtcp |
207 } // namespace webrtc | 212 } // namespace webrtc |
OLD | NEW |