Use RtcpPacket to send FIR in RtcpSender

BUG=webrtc:2450

Review URL: https://codereview.webrtc.org/1261323003

Cr-Commit-Position: refs/heads/master@{#9677}
This commit is contained in:
sprang
2015-08-05 02:35:35 -07:00
committed by Commit bot
parent ef7228cfa0
commit 62dae19098

View File

@ -564,36 +564,17 @@ RTCPSender::BuildResult RTCPSender::BuildPLI(RtcpContext* ctx) {
} }
RTCPSender::BuildResult RTCPSender::BuildFIR(RtcpContext* ctx) { RTCPSender::BuildResult RTCPSender::BuildFIR(RtcpContext* ctx) {
// sanity
if (ctx->position + 20 >= IP_PACKET_SIZE)
return BuildResult::kTruncated;
if (!ctx->repeat) if (!ctx->repeat)
sequence_number_fir_++; // do not increase if repetition ++sequence_number_fir_; // Do not increase if repetition.
// add full intra request indicator rtcp::Fir fir;
uint8_t FMT = 4; fir.From(ssrc_);
*ctx->AllocateData(1) = 0x80 + FMT; fir.To(remote_ssrc_);
*ctx->AllocateData(1) = 206; fir.WithCommandSeqNum(sequence_number_fir_);
//Length of 4 PacketBuiltCallback callback(ctx);
*ctx->AllocateData(1) = 0; if (!callback.BuildPacket(fir))
*ctx->AllocateData(1) = 4; return BuildResult::kTruncated;
// Add our own SSRC
ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), ssrc_);
// RFC 5104 4.3.1.2. Semantics
// SSRC of media source
ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), 0);
// Additional Feedback Control Information (FCI)
ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), remote_ssrc_);
*ctx->AllocateData(1) = sequence_number_fir_;
*ctx->AllocateData(1) = 0;
*ctx->AllocateData(1) = 0;
*ctx->AllocateData(1) = 0;
TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
"RTCPSender::FIR"); "RTCPSender::FIR");