Use RtcpPacket to send BYE in RtcpSender
BUG=webrtc:2450 Review URL: https://codereview.webrtc.org/1306893003 Cr-Commit-Position: refs/heads/master@{#9763}
This commit is contained in:
@ -885,26 +885,15 @@ RTCPSender::BuildResult RTCPSender::BuildNACK(RtcpContext* ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RTCPSender::BuildResult RTCPSender::BuildBYE(RtcpContext* ctx) {
|
RTCPSender::BuildResult RTCPSender::BuildBYE(RtcpContext* ctx) {
|
||||||
// sanity
|
rtcp::Bye bye;
|
||||||
if (ctx->position + 8 >= IP_PACKET_SIZE)
|
bye.From(ssrc_);
|
||||||
|
for (uint32_t csrc : csrcs_)
|
||||||
|
bye.WithCsrc(csrc);
|
||||||
|
|
||||||
|
PacketBuiltCallback callback(ctx);
|
||||||
|
if (!callback.BuildPacket(bye))
|
||||||
return BuildResult::kTruncated;
|
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());
|
|
||||||
|
|
||||||
// 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]);
|
|
||||||
|
|
||||||
return BuildResult::kSuccess;
|
return BuildResult::kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user