Always send RED headers if configured.

This shouldn't be needed, but because the receiver assumes RTX packets
contain RED if configured to receive them (due to an incompatibility
issue), we also have to make sure we send them for now.

BUG=webrtc:5675

Review-Url: https://codereview.webrtc.org/2033763002
Cr-Commit-Position: refs/heads/master@{#13024}
This commit is contained in:
stefan
2016-06-03 00:16:45 -07:00
committed by Commit bot
parent 72d41aa6da
commit 8f4c77fea1
3 changed files with 40 additions and 28 deletions

View File

@ -36,8 +36,8 @@ RTPSenderVideo::RTPSenderVideo(Clock* clock, RTPSenderInterface* rtpSender)
// Generic FEC
fec_(),
fec_enabled_(false),
red_payload_type_(-1),
fec_payload_type_(-1),
red_payload_type_(0),
fec_payload_type_(0),
delta_fec_params_(),
key_fec_params_(),
producer_fec_(&fec_),
@ -191,16 +191,19 @@ void RTPSenderVideo::GenericFECStatus(bool* enable,
size_t RTPSenderVideo::FECPacketOverhead() const {
rtc::CritScope cs(&crit_);
if (fec_enabled_) {
size_t overhead = 0;
if (red_payload_type_ != 0) {
// Overhead is FEC headers plus RED for FEC header plus anything in RTP
// header beyond the 12 bytes base header (CSRC list, extensions...)
// This reason for the header extensions to be included here is that
// from an FEC viewpoint, they are part of the payload to be protected.
// (The base RTP header is already protected by the FEC header.)
return ForwardErrorCorrection::PacketOverhead() + REDForFECHeaderLength +
(_rtpSender.RTPHeaderLength() - kRtpHeaderSize);
overhead = REDForFECHeaderLength + (_rtpSender.RTPHeaderLength() -
kRtpHeaderSize);
}
return 0;
if (fec_enabled_)
overhead += ForwardErrorCorrection::PacketOverhead();
return overhead;
}
void RTPSenderVideo::SetFecParameters(const FecProtectionParams* delta_params,
@ -208,8 +211,10 @@ void RTPSenderVideo::SetFecParameters(const FecProtectionParams* delta_params,
rtc::CritScope cs(&crit_);
RTC_DCHECK(delta_params);
RTC_DCHECK(key_params);
delta_fec_params_ = *delta_params;
key_fec_params_ = *key_params;
if (fec_enabled_) {
delta_fec_params_ = *delta_params;
key_fec_params_ = *key_params;
}
}
int32_t RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType,
@ -230,7 +235,7 @@ int32_t RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType,
video_header ? &(video_header->codecHeader) : nullptr, frameType));
StorageType storage;
bool fec_enabled;
int red_payload_type;
bool first_frame = first_frame_sent_();
{
rtc::CritScope cs(&crit_);
@ -238,7 +243,7 @@ int32_t RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType,
frameType == kVideoFrameKey ? &key_fec_params_ : &delta_fec_params_;
producer_fec_.SetFecParameters(fec_params, 0);
storage = packetizer->GetStorageType(_retransmissionSettings);
fec_enabled = fec_enabled_;
red_payload_type = red_payload_type_;
}
// Register CVO rtp header extension at the first time when we receive a frame
@ -301,7 +306,7 @@ int32_t RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType,
_rtpSender.UpdateVideoRotation(dataBuffer, packetSize, rtp_header,
video_header->rotation);
}
if (fec_enabled) {
if (red_payload_type != 0) {
SendVideoPacketAsRed(dataBuffer, payload_bytes_in_packet,
rtp_header_length, _rtpSender.SequenceNumber(),
captureTimeStamp, capture_time_ms, storage,