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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return false; | 148 return false; |
149 } | 149 } |
150 Chunk chunk; | 150 Chunk chunk; |
151 chunk.ssrc = ssrc; | 151 chunk.ssrc = ssrc; |
152 chunk.cname = std::move(cname); | 152 chunk.cname = std::move(cname); |
153 chunks_.push_back(chunk); | 153 chunks_.push_back(chunk); |
154 block_length_ += ChunkSize(chunk); | 154 block_length_ += ChunkSize(chunk); |
155 return true; | 155 return true; |
156 } | 156 } |
157 | 157 |
| 158 size_t Sdes::BlockLength() const { |
| 159 return block_length_; |
| 160 } |
| 161 |
158 bool Sdes::Create(uint8_t* packet, | 162 bool Sdes::Create(uint8_t* packet, |
159 size_t* index, | 163 size_t* index, |
160 size_t max_length, | 164 size_t max_length, |
161 RtcpPacket::PacketReadyCallback* callback) const { | 165 RtcpPacket::PacketReadyCallback* callback) const { |
162 while (*index + BlockLength() > max_length) { | 166 while (*index + BlockLength() > max_length) { |
163 if (!OnBufferFull(packet, index, callback)) | 167 if (!OnBufferFull(packet, index, callback)) |
164 return false; | 168 return false; |
165 } | 169 } |
166 const size_t index_end = *index + BlockLength(); | 170 const size_t index_end = *index + BlockLength(); |
167 CreateHeader(chunks_.size(), kPacketType, HeaderLength(), packet, index); | 171 CreateHeader(chunks_.size(), kPacketType, HeaderLength(), packet, index); |
(...skipping 13 matching lines...) Expand all Loading... |
181 const int kPadding = 0; | 185 const int kPadding = 0; |
182 memset(packet + *index, kPadding, padding_size); | 186 memset(packet + *index, kPadding, padding_size); |
183 *index += padding_size; | 187 *index += padding_size; |
184 } | 188 } |
185 | 189 |
186 RTC_CHECK_EQ(*index, index_end); | 190 RTC_CHECK_EQ(*index, index_end); |
187 return true; | 191 return true; |
188 } | 192 } |
189 } // namespace rtcp | 193 } // namespace rtcp |
190 } // namespace webrtc | 194 } // namespace webrtc |
OLD | NEW |