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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
index 6967754fe62f737e73f450314da31bf1ebd9dcdd..f55f33b6a660f47e53dd90b2a5e6a255de2ca024 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -612,30 +612,17 @@ RTCPSender::BuildResult RTCPSender::BuildFIR(RtcpContext* ctx) {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
RTCPSender::BuildResult RTCPSender::BuildSLI(RtcpContext* ctx) {
- // sanity
- if (ctx->position + 16 >= IP_PACKET_SIZE)
- return BuildResult::kTruncated;
-
- // add slice loss indicator
- uint8_t FMT = 2;
- *ctx->AllocateData(1) = 0x80 + FMT;
- *ctx->AllocateData(1) = 206;
-
- // Used fixed length of 3
- *ctx->AllocateData(1) = 0;
- *ctx->AllocateData(1) = 3;
+ rtcp::Sli sli;
+ sli.From(ssrc_);
+ sli.To(remote_ssrc_);
+ // Crop picture id to 6 least significant bits.
+ sli.WithPictureId(ctx->picture_id & 0x3F);
+ sli.WithFirstMb(0);
+ sli.WithNumberOfMb(0x1FFF); // 13 bits, only ones for now.
- // Add our own SSRC
- ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), ssrc_);
-
- // Add the remote SSRC
- ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), remote_ssrc_);
-
- // Add first, number & picture ID 6 bits
- // first = 0, 13 - bits
- // number = 0x1fff, 13 - bits only ones for now
- uint32_t sliField = (0x1fff << 6) + (0x3f & ctx->picture_id);
- ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), sliField);
+ PacketBuiltCallback callback(ctx);
+ if (!callback.BuildPacket(sli))
+ return BuildResult::kTruncated;
return BuildResult::kSuccess;
}
« 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