Index: webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc |
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc |
index 72425671599b06321eeae1ae56e1de20a2a505d9..9838da7104bce62c84ca45bad4b8c77c55c80b58 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc |
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc |
@@ -170,28 +170,33 @@ void RTPSenderVideo::SendVideoPacketAsRed( |
} |
} |
-void RTPSenderVideo::SetUlpfecConfig(bool enabled, |
- int red_payload_type, |
+void RTPSenderVideo::SetUlpfecConfig(int red_payload_type, |
int ulpfec_payload_type) { |
- RTC_DCHECK(!enabled || red_payload_type > 0); |
+ // Sanity check. Per the definition of UlpfecConfig (see config.h), |
+ // a payload type of -1 means that the corresponding feature is |
+ // turned off. |
+ RTC_DCHECK_GE(red_payload_type, -1); |
RTC_DCHECK_LE(red_payload_type, 127); |
+ RTC_DCHECK_GE(ulpfec_payload_type, -1); |
RTC_DCHECK_LE(ulpfec_payload_type, 127); |
rtc::CritScope cs(&crit_); |
- fec_enabled_ = enabled; |
red_payload_type_ = red_payload_type; |
+ red_enabled_ = (red_payload_type_ != -1); |
fec_payload_type_ = ulpfec_payload_type; |
+ fec_enabled_ = (fec_payload_type_ != -1); |
+ |
+ // TODO(brandtr): Remove when the RED/RTX workaround is removed. |
+ RTC_DCHECK(red_enabled_ || !fec_enabled_); |
// Reset FEC rates. |
delta_fec_params_ = FecProtectionParams{0, 1, kFecMaskRandom}; |
key_fec_params_ = FecProtectionParams{0, 1, kFecMaskRandom}; |
} |
-void RTPSenderVideo::UlpfecConfig(bool* enabled, |
- int* red_payload_type, |
+void RTPSenderVideo::UlpfecConfig(int* red_payload_type, |
int* ulpfec_payload_type) const { |
rtc::CritScope cs(&crit_); |
- *enabled = fec_enabled_; |
*red_payload_type = red_payload_type_; |
*ulpfec_payload_type = fec_payload_type_; |
} |
@@ -199,7 +204,7 @@ void RTPSenderVideo::UlpfecConfig(bool* enabled, |
size_t RTPSenderVideo::FecPacketOverhead() const { |
rtc::CritScope cs(&crit_); |
size_t overhead = 0; |
- if (red_payload_type_ != -1) { |
+ if (red_enabled_) { |
// 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 |
@@ -272,7 +277,7 @@ bool RTPSenderVideo::SendVideo(RtpVideoCodecTypes video_type, |
video_header ? &(video_header->codecHeader) : nullptr, frame_type)); |
StorageType storage; |
- int red_payload_type; |
+ bool red_enabled; |
bool first_frame = first_frame_sent_(); |
{ |
rtc::CritScope cs(&crit_); |
@@ -280,7 +285,7 @@ bool RTPSenderVideo::SendVideo(RtpVideoCodecTypes video_type, |
frame_type == kVideoFrameKey ? &key_fec_params_ : &delta_fec_params_; |
producer_fec_.SetFecParameters(fec_params); |
storage = packetizer->GetStorageType(retransmission_settings_); |
- red_payload_type = red_payload_type_; |
+ red_enabled = red_enabled_; |
} |
// TODO(changbin): we currently don't support to configure the codec to |
@@ -307,7 +312,7 @@ bool RTPSenderVideo::SendVideo(RtpVideoCodecTypes video_type, |
if (!rtp_sender_->AssignSequenceNumber(packet.get())) |
return false; |
- if (red_payload_type != -1) { |
+ if (red_enabled) { |
SendVideoPacketAsRed(std::move(packet), storage, |
packetizer->GetProtectionType() == kProtectedPacket); |
} else { |