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

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

Issue 1268383002: Use RtcpPacket to send SLI in RtcpSender (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 } 605 }
606 606
607 /* 607 /*
608 0 1 2 3 608 0 1 2 3
609 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 609 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
610 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 610 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
611 | First | Number | PictureID | 611 | First | Number | PictureID |
612 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 612 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
613 */ 613 */
614 RTCPSender::BuildResult RTCPSender::BuildSLI(RtcpContext* ctx) { 614 RTCPSender::BuildResult RTCPSender::BuildSLI(RtcpContext* ctx) {
615 // sanity 615 rtcp::Sli sli;
616 if (ctx->position + 16 >= IP_PACKET_SIZE) 616 sli.From(ssrc_);
617 sli.To(remote_ssrc_);
618 // Crop picture id to 6 least significant bits.
619 sli.WithPictureId(ctx->picture_id & 0x3F);
620 sli.WithFirstMb(0);
621 sli.WithNumberOfMb(0x1FFF); // 13 bits, only ones for now.
622
623 PacketBuiltCallback callback(ctx);
624 if (!callback.BuildPacket(sli))
617 return BuildResult::kTruncated; 625 return BuildResult::kTruncated;
618 626
619 // add slice loss indicator
620 uint8_t FMT = 2;
621 *ctx->AllocateData(1) = 0x80 + FMT;
622 *ctx->AllocateData(1) = 206;
623
624 // Used fixed length of 3
625 *ctx->AllocateData(1) = 0;
626 *ctx->AllocateData(1) = 3;
627
628 // Add our own SSRC
629 ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), ssrc_);
630
631 // Add the remote SSRC
632 ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), remote_ssrc_);
633
634 // Add first, number & picture ID 6 bits
635 // first = 0, 13 - bits
636 // number = 0x1fff, 13 - bits only ones for now
637 uint32_t sliField = (0x1fff << 6) + (0x3f & ctx->picture_id);
638 ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), sliField);
639
640 return BuildResult::kSuccess; 627 return BuildResult::kSuccess;
641 } 628 }
642 629
643 /* 630 /*
644 0 1 2 3 631 0 1 2 3
645 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 632 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
646 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 633 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
647 | PB |0| Payload Type| Native RPSI bit string | 634 | PB |0| Payload Type| Native RPSI bit string |
648 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 635 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
649 | defined per codec ... | Padding (0) | 636 | defined per codec ... | Padding (0) |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 1475
1489 bool RTCPSender::AllVolatileFlagsConsumed() const { 1476 bool RTCPSender::AllVolatileFlagsConsumed() const {
1490 for (const ReportFlag& flag : report_flags_) { 1477 for (const ReportFlag& flag : report_flags_) {
1491 if (flag.is_volatile) 1478 if (flag.is_volatile)
1492 return false; 1479 return false;
1493 } 1480 }
1494 return true; 1481 return true;
1495 } 1482 }
1496 1483
1497 } // namespace webrtc 1484 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698