| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 void CreateBye(const RTCPPacketBYE& bye, | 243 void CreateBye(const RTCPPacketBYE& bye, |
| 244 const std::vector<uint32_t>& csrcs, | 244 const std::vector<uint32_t>& csrcs, |
| 245 uint8_t* buffer, | 245 uint8_t* buffer, |
| 246 size_t* pos) { | 246 size_t* pos) { |
| 247 AssignUWord32(buffer, pos, bye.SenderSSRC); | 247 AssignUWord32(buffer, pos, bye.SenderSSRC); |
| 248 for (uint32_t csrc : csrcs) | 248 for (uint32_t csrc : csrcs) |
| 249 AssignUWord32(buffer, pos, csrc); | 249 AssignUWord32(buffer, pos, csrc); |
| 250 } | 250 } |
| 251 | 251 |
| 252 // Application-Defined packet (APP) (RFC 3550). | |
| 253 // | |
| 254 // 0 1 2 3 | |
| 255 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
| 256 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 257 // |V=2|P| subtype | PT=APP=204 | length | | |
| 258 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 259 // | SSRC/CSRC | | |
| 260 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 261 // | name (ASCII) | | |
| 262 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 263 // | application-dependent data ... | |
| 264 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 265 | |
| 266 void CreateApp(const RTCPPacketAPP& app, | |
| 267 uint32_t ssrc, | |
| 268 uint8_t* buffer, | |
| 269 size_t* pos) { | |
| 270 AssignUWord32(buffer, pos, ssrc); | |
| 271 AssignUWord32(buffer, pos, app.Name); | |
| 272 memcpy(buffer + *pos, app.Data, app.Size); | |
| 273 *pos += app.Size; | |
| 274 } | |
| 275 | |
| 276 // RFC 4585: Feedback format. | 252 // RFC 4585: Feedback format. |
| 277 // | 253 // |
| 278 // Common packet format: | 254 // Common packet format: |
| 279 // | 255 // |
| 280 // 0 1 2 3 | 256 // 0 1 2 3 |
| 281 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 257 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 282 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 258 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 283 // |V=2|P| FMT | PT | length | | 259 // |V=2|P| FMT | PT | length | |
| 284 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 260 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 285 // | SSRC of packet sender | | 261 // | SSRC of packet sender | |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 | 862 |
| 887 bool Bye::WithCsrc(uint32_t csrc) { | 863 bool Bye::WithCsrc(uint32_t csrc) { |
| 888 if (csrcs_.size() >= kMaxNumberOfCsrcs) { | 864 if (csrcs_.size() >= kMaxNumberOfCsrcs) { |
| 889 LOG(LS_WARNING) << "Max CSRC size reached."; | 865 LOG(LS_WARNING) << "Max CSRC size reached."; |
| 890 return false; | 866 return false; |
| 891 } | 867 } |
| 892 csrcs_.push_back(csrc); | 868 csrcs_.push_back(csrc); |
| 893 return true; | 869 return true; |
| 894 } | 870 } |
| 895 | 871 |
| 896 bool App::Create(uint8_t* packet, | |
| 897 size_t* index, | |
| 898 size_t max_length, | |
| 899 RtcpPacket::PacketReadyCallback* callback) const { | |
| 900 while (*index + BlockLength() > max_length) { | |
| 901 if (!OnBufferFull(packet, index, callback)) | |
| 902 return false; | |
| 903 } | |
| 904 CreateHeader(app_.SubType, PT_APP, HeaderLength(), packet, index); | |
| 905 CreateApp(app_, ssrc_, packet, index); | |
| 906 return true; | |
| 907 } | |
| 908 | |
| 909 bool Pli::Create(uint8_t* packet, | 872 bool Pli::Create(uint8_t* packet, |
| 910 size_t* index, | 873 size_t* index, |
| 911 size_t max_length, | 874 size_t max_length, |
| 912 RtcpPacket::PacketReadyCallback* callback) const { | 875 RtcpPacket::PacketReadyCallback* callback) const { |
| 913 while (*index + BlockLength() > max_length) { | 876 while (*index + BlockLength() > max_length) { |
| 914 if (!OnBufferFull(packet, index, callback)) | 877 if (!OnBufferFull(packet, index, callback)) |
| 915 return false; | 878 return false; |
| 916 } | 879 } |
| 917 const uint8_t kFmt = 1; | 880 const uint8_t kFmt = 1; |
| 918 CreateHeader(kFmt, PT_PSFB, HeaderLength(), packet, index); | 881 CreateHeader(kFmt, PT_PSFB, HeaderLength(), packet, index); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 return length_; | 1177 return length_; |
| 1215 } | 1178 } |
| 1216 | 1179 |
| 1217 void RawPacket::SetLength(size_t length) { | 1180 void RawPacket::SetLength(size_t length) { |
| 1218 assert(length <= buffer_length_); | 1181 assert(length <= buffer_length_); |
| 1219 length_ = length; | 1182 length_ = length; |
| 1220 } | 1183 } |
| 1221 | 1184 |
| 1222 } // namespace rtcp | 1185 } // namespace rtcp |
| 1223 } // namespace webrtc | 1186 } // namespace webrtc |
| OLD | NEW |