Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet.cc

Issue 1446513002: rtcp::Pli moved into own file and got a Parse function (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 void CreateApp(const RTCPPacketAPP& app, 244 void CreateApp(const RTCPPacketAPP& app,
245 uint32_t ssrc, 245 uint32_t ssrc,
246 uint8_t* buffer, 246 uint8_t* buffer,
247 size_t* pos) { 247 size_t* pos) {
248 AssignUWord32(buffer, pos, ssrc); 248 AssignUWord32(buffer, pos, ssrc);
249 AssignUWord32(buffer, pos, app.Name); 249 AssignUWord32(buffer, pos, app.Name);
250 memcpy(buffer + *pos, app.Data, app.Size); 250 memcpy(buffer + *pos, app.Data, app.Size);
251 *pos += app.Size; 251 *pos += app.Size;
252 } 252 }
253 253
254 // RFC 4585: Feedback format.
255 //
256 // Common packet format:
257 //
258 // 0 1 2 3
259 // 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
260 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
261 // |V=2|P| FMT | PT | length |
262 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
263 // | SSRC of packet sender |
264 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
265 // | SSRC of media source |
266 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
267 // : Feedback Control Information (FCI) :
268 // :
269 //
270
271 // Picture loss indication (PLI) (RFC 4585).
272 //
273 // FCI: no feedback control information.
274
275 void CreatePli(const RTCPPacketPSFBPLI& pli,
276 uint8_t* buffer,
277 size_t* pos) {
278 AssignUWord32(buffer, pos, pli.SenderSSRC);
279 AssignUWord32(buffer, pos, pli.MediaSSRC);
280 }
281 254
282 // Slice loss indication (SLI) (RFC 4585). 255 // Slice loss indication (SLI) (RFC 4585).
283 // 256 //
284 // FCI: 257 // FCI:
285 // 258 //
286 // 0 1 2 3 259 // 0 1 2 3
287 // 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 260 // 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
288 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 261 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
289 // | First | Number | PictureID | 262 // | First | Number | PictureID |
290 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 263 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 RtcpPacket::PacketReadyCallback* callback) const { 827 RtcpPacket::PacketReadyCallback* callback) const {
855 while (*index + BlockLength() > max_length) { 828 while (*index + BlockLength() > max_length) {
856 if (!OnBufferFull(packet, index, callback)) 829 if (!OnBufferFull(packet, index, callback))
857 return false; 830 return false;
858 } 831 }
859 CreateHeader(app_.SubType, PT_APP, HeaderLength(), packet, index); 832 CreateHeader(app_.SubType, PT_APP, HeaderLength(), packet, index);
860 CreateApp(app_, ssrc_, packet, index); 833 CreateApp(app_, ssrc_, packet, index);
861 return true; 834 return true;
862 } 835 }
863 836
864 bool Pli::Create(uint8_t* packet,
865 size_t* index,
866 size_t max_length,
867 RtcpPacket::PacketReadyCallback* callback) const {
868 while (*index + BlockLength() > max_length) {
869 if (!OnBufferFull(packet, index, callback))
870 return false;
871 }
872 const uint8_t kFmt = 1;
873 CreateHeader(kFmt, PT_PSFB, HeaderLength(), packet, index);
874 CreatePli(pli_, packet, index);
875 return true;
876 }
877
878 bool Sli::Create(uint8_t* packet, 837 bool Sli::Create(uint8_t* packet,
879 size_t* index, 838 size_t* index,
880 size_t max_length, 839 size_t max_length,
881 RtcpPacket::PacketReadyCallback* callback) const { 840 RtcpPacket::PacketReadyCallback* callback) const {
882 while (*index + BlockLength() > max_length) { 841 while (*index + BlockLength() > max_length) {
883 if (!OnBufferFull(packet, index, callback)) 842 if (!OnBufferFull(packet, index, callback))
884 return false; 843 return false;
885 } 844 }
886 const uint8_t kFmt = 2; 845 const uint8_t kFmt = 2;
887 CreateHeader(kFmt, PT_PSFB, HeaderLength(), packet, index); 846 CreateHeader(kFmt, PT_PSFB, HeaderLength(), packet, index);
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 return length_; 1128 return length_;
1170 } 1129 }
1171 1130
1172 void RawPacket::SetLength(size_t length) { 1131 void RawPacket::SetLength(size_t length) {
1173 assert(length <= buffer_length_); 1132 assert(length <= buffer_length_);
1174 length_ = length; 1133 length_ = length;
1175 } 1134 }
1176 1135
1177 } // namespace rtcp 1136 } // namespace rtcp
1178 } // namespace webrtc 1137 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698