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

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

Issue 1551893002: [rtp_rtcp] rtcp::Sli packet moved into own file and got Parse function (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 months 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 16 matching lines...) Expand all
27 using webrtc::RTCPUtility::PT_SDES; 27 using webrtc::RTCPUtility::PT_SDES;
28 using webrtc::RTCPUtility::PT_SR; 28 using webrtc::RTCPUtility::PT_SR;
29 using webrtc::RTCPUtility::PT_XR; 29 using webrtc::RTCPUtility::PT_XR;
30 30
31 using webrtc::RTCPUtility::RTCPPacketAPP; 31 using webrtc::RTCPUtility::RTCPPacketAPP;
32 using webrtc::RTCPUtility::RTCPPacketPSFBAPP; 32 using webrtc::RTCPUtility::RTCPPacketPSFBAPP;
33 using webrtc::RTCPUtility::RTCPPacketPSFBFIR; 33 using webrtc::RTCPUtility::RTCPPacketPSFBFIR;
34 using webrtc::RTCPUtility::RTCPPacketPSFBFIRItem; 34 using webrtc::RTCPUtility::RTCPPacketPSFBFIRItem;
35 using webrtc::RTCPUtility::RTCPPacketPSFBREMBItem; 35 using webrtc::RTCPUtility::RTCPPacketPSFBREMBItem;
36 using webrtc::RTCPUtility::RTCPPacketPSFBRPSI; 36 using webrtc::RTCPUtility::RTCPPacketPSFBRPSI;
37 using webrtc::RTCPUtility::RTCPPacketPSFBSLI;
38 using webrtc::RTCPUtility::RTCPPacketPSFBSLIItem;
39 using webrtc::RTCPUtility::RTCPPacketReportBlockItem; 37 using webrtc::RTCPUtility::RTCPPacketReportBlockItem;
40 using webrtc::RTCPUtility::RTCPPacketRTPFBNACK; 38 using webrtc::RTCPUtility::RTCPPacketRTPFBNACK;
41 using webrtc::RTCPUtility::RTCPPacketRTPFBNACKItem; 39 using webrtc::RTCPUtility::RTCPPacketRTPFBNACKItem;
42 using webrtc::RTCPUtility::RTCPPacketSR; 40 using webrtc::RTCPUtility::RTCPPacketSR;
43 using webrtc::RTCPUtility::RTCPPacketXRDLRRReportBlockItem; 41 using webrtc::RTCPUtility::RTCPPacketXRDLRRReportBlockItem;
44 using webrtc::RTCPUtility::RTCPPacketXR; 42 using webrtc::RTCPUtility::RTCPPacketXR;
45 43
46 namespace webrtc { 44 namespace webrtc {
47 namespace rtcp { 45 namespace rtcp {
48 namespace { 46 namespace {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 AssignUWord32(buffer, pos, (*it).ssrc); 172 AssignUWord32(buffer, pos, (*it).ssrc);
175 AssignUWord8(buffer, pos, kSdesItemType); 173 AssignUWord8(buffer, pos, kSdesItemType);
176 AssignUWord8(buffer, pos, (*it).name.length()); 174 AssignUWord8(buffer, pos, (*it).name.length());
177 memcpy(buffer + *pos, (*it).name.data(), (*it).name.length()); 175 memcpy(buffer + *pos, (*it).name.data(), (*it).name.length());
178 *pos += (*it).name.length(); 176 *pos += (*it).name.length();
179 memset(buffer + *pos, 0, (*it).null_octets); 177 memset(buffer + *pos, 0, (*it).null_octets);
180 *pos += (*it).null_octets; 178 *pos += (*it).null_octets;
181 } 179 }
182 } 180 }
183 181
184 // Slice loss indication (SLI) (RFC 4585).
185 //
186 // FCI:
187 //
188 // 0 1 2 3
189 // 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
190 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
191 // | First | Number | PictureID |
192 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
193
194 void CreateSli(const RTCPPacketPSFBSLI& sli,
195 const RTCPPacketPSFBSLIItem& sli_item,
196 uint8_t* buffer,
197 size_t* pos) {
198 AssignUWord32(buffer, pos, sli.SenderSSRC);
199 AssignUWord32(buffer, pos, sli.MediaSSRC);
200
201 AssignUWord8(buffer, pos, sli_item.FirstMB >> 5);
202 AssignUWord8(buffer, pos, (sli_item.FirstMB << 3) +
203 ((sli_item.NumberOfMB >> 10) & 0x07));
204 AssignUWord8(buffer, pos, sli_item.NumberOfMB >> 2);
205 AssignUWord8(buffer, pos, (sli_item.NumberOfMB << 6) + sli_item.PictureId);
206 }
207
208 // Reference picture selection indication (RPSI) (RFC 4585). 182 // Reference picture selection indication (RPSI) (RFC 4585).
209 // 183 //
210 // FCI: 184 // FCI:
211 // 185 //
212 // 0 1 2 3 186 // 0 1 2 3
213 // 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 187 // 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
214 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 188 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
215 // | PB |0| Payload Type| Native RPSI bit string | 189 // | PB |0| Payload Type| Native RPSI bit string |
216 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 190 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
217 // | defined per codec ... | Padding (0) | 191 // | defined per codec ... | Padding (0) |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 // Header (4 bytes). 461 // Header (4 bytes).
488 // Chunk: 462 // Chunk:
489 // SSRC/CSRC (4 bytes) | CNAME (1 byte) | length (1 byte) | name | padding. 463 // SSRC/CSRC (4 bytes) | CNAME (1 byte) | length (1 byte) | name | padding.
490 size_t length = kHeaderLength; 464 size_t length = kHeaderLength;
491 for (const Chunk& chunk : chunks_) 465 for (const Chunk& chunk : chunks_)
492 length += 6 + chunk.name.length() + chunk.null_octets; 466 length += 6 + chunk.name.length() + chunk.null_octets;
493 assert(length % 4 == 0); 467 assert(length % 4 == 0);
494 return length; 468 return length;
495 } 469 }
496 470
497 bool Sli::Create(uint8_t* packet,
498 size_t* index,
499 size_t max_length,
500 RtcpPacket::PacketReadyCallback* callback) const {
501 while (*index + BlockLength() > max_length) {
502 if (!OnBufferFull(packet, index, callback))
503 return false;
504 }
505 const uint8_t kFmt = 2;
506 CreateHeader(kFmt, PT_PSFB, HeaderLength(), packet, index);
507 CreateSli(sli_, sli_item_, packet, index);
508 return true;
509 }
510
511 bool Rpsi::Create(uint8_t* packet, 471 bool Rpsi::Create(uint8_t* packet,
512 size_t* index, 472 size_t* index,
513 size_t max_length, 473 size_t max_length,
514 RtcpPacket::PacketReadyCallback* callback) const { 474 RtcpPacket::PacketReadyCallback* callback) const {
515 assert(rpsi_.NumberOfValidBits > 0); 475 assert(rpsi_.NumberOfValidBits > 0);
516 while (*index + BlockLength() > max_length) { 476 while (*index + BlockLength() > max_length) {
517 if (!OnBufferFull(packet, index, callback)) 477 if (!OnBufferFull(packet, index, callback))
518 return false; 478 return false;
519 } 479 }
520 const uint8_t kFmt = 3; 480 const uint8_t kFmt = 3;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 return length_; 636 return length_;
677 } 637 }
678 638
679 void RawPacket::SetLength(size_t length) { 639 void RawPacket::SetLength(size_t length) {
680 assert(length <= buffer_length_); 640 assert(length <= buffer_length_);
681 length_ = length; 641 length_ = length;
682 } 642 }
683 643
684 } // namespace rtcp 644 } // namespace rtcp
685 } // namespace webrtc 645 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698