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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_sender.cc

Issue 1306893003: Use RtcpPacket to send BYE 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 | no next file » | 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 4c840372f56295dcf521d7d3ff1a79be3e218b82..1f5bf551418dc20ab8bbac00b0b9e4c43f555087 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -885,25 +885,14 @@ RTCPSender::BuildResult RTCPSender::BuildNACK(RtcpContext* ctx) {
}
RTCPSender::BuildResult RTCPSender::BuildBYE(RtcpContext* ctx) {
- // sanity
- if (ctx->position + 8 >= IP_PACKET_SIZE)
- return BuildResult::kTruncated;
-
- // Add a bye packet
- // Number of SSRC + CSRCs.
- *ctx->AllocateData(1) = static_cast<uint8_t>(0x80 + 1 + csrcs_.size());
- *ctx->AllocateData(1) = 203;
-
- // length
- *ctx->AllocateData(1) = 0;
- *ctx->AllocateData(1) = static_cast<uint8_t>(1 + csrcs_.size());
+ rtcp::Bye bye;
+ bye.From(ssrc_);
+ for (uint32_t csrc : csrcs_)
+ bye.WithCsrc(csrc);
- // Add our own SSRC
- ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), ssrc_);
-
- // add CSRCs
- for (size_t i = 0; i < csrcs_.size(); i++)
- ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), csrcs_[i]);
+ PacketBuiltCallback callback(ctx);
+ if (!callback.BuildPacket(bye))
+ return BuildResult::kTruncated;
return BuildResult::kSuccess;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698