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..57c77a90a7257801c4982b0fa8d9720c69e3fb96 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc |
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc |
@@ -564,36 +564,17 @@ RTCPSender::BuildResult RTCPSender::BuildPLI(RtcpContext* ctx) { |
} |
RTCPSender::BuildResult RTCPSender::BuildFIR(RtcpContext* ctx) { |
- // sanity |
- if (ctx->position + 20 >= IP_PACKET_SIZE) |
- return BuildResult::kTruncated; |
- |
if (!ctx->repeat) |
- sequence_number_fir_++; // do not increase if repetition |
- |
- // add full intra request indicator |
- uint8_t FMT = 4; |
- *ctx->AllocateData(1) = 0x80 + FMT; |
- *ctx->AllocateData(1) = 206; |
- |
- //Length of 4 |
- *ctx->AllocateData(1) = 0; |
- *ctx->AllocateData(1) = 4; |
- |
- // 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); |
+ ++sequence_number_fir_; // Do not increase if repetition. |
- // Additional Feedback Control Information (FCI) |
- ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), remote_ssrc_); |
+ rtcp::Fir fir; |
+ fir.From(ssrc_); |
+ fir.To(remote_ssrc_); |
+ fir.WithCommandSeqNum(sequence_number_fir_); |
- *ctx->AllocateData(1) = sequence_number_fir_; |
- *ctx->AllocateData(1) = 0; |
- *ctx->AllocateData(1) = 0; |
- *ctx->AllocateData(1) = 0; |
+ PacketBuiltCallback callback(ctx); |
+ if (!callback.BuildPacket(fir)) |
+ return BuildResult::kTruncated; |
TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
"RTCPSender::FIR"); |