diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc index c6ef6037f7..f8f4ea68a8 100644 --- a/media/engine/webrtc_video_engine.cc +++ b/media/engine/webrtc_video_engine.cc @@ -1502,8 +1502,8 @@ void WebRtcVideoChannel::ConfigureReceiverRtp( // rtx-time (RFC 4588) is a declarative attribute similar to rtcp-rsize and // determined by the sender / send codec. - if (send_codec_ && send_codec_->rtx_time != -1) { - config->rtp.nack.rtp_history_ms = send_codec_->rtx_time; + if (send_codec_ && send_codec_->rtx_time) { + config->rtp.nack.rtp_history_ms = *send_codec_->rtx_time; } sp.GetFidSsrc(ssrc, &config->rtp.rtx_ssrc); @@ -2903,8 +2903,8 @@ WebRtcVideoChannel::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream( config_.rtp.red_payload_type = codec.ulpfec.red_payload_type; config_.rtp.lntf.enabled = HasLntf(codec.codec); config_.rtp.nack.rtp_history_ms = HasNack(codec.codec) ? kNackHistoryMs : 0; - if (codec.rtx_time != -1 && config_.rtp.nack.rtp_history_ms != 0) { - config_.rtp.nack.rtp_history_ms = codec.rtx_time; + if (codec.rtx_time && config_.rtp.nack.rtp_history_ms != 0) { + config_.rtp.nack.rtp_history_ms = *codec.rtx_time; } config_.rtp.rtcp_xr.receiver_reference_time_report = HasRrtr(codec.codec); @@ -3003,8 +3003,8 @@ bool WebRtcVideoChannel::WebRtcVideoReceiveStream::ReconfigureCodecs( // The rtx-time parameter can be used to override the hardcoded default for // the NACK buffer length. - if (codec.rtx_time != -1 && new_history_ms != 0) { - new_history_ms = codec.rtx_time; + if (codec.rtx_time && new_history_ms != 0) { + new_history_ms = *codec.rtx_time; } if (config_.rtp.nack.rtp_history_ms != new_history_ms) { @@ -3048,7 +3048,7 @@ void WebRtcVideoChannel::WebRtcVideoReceiveStream::SetFeedbackParameters( bool lntf_enabled, bool nack_enabled, webrtc::RtcpMode rtcp_mode, - int rtx_time) { + absl::optional rtx_time) { RTC_DCHECK(stream_); if (config_.rtp.rtcp_mode != rtcp_mode) { @@ -3064,8 +3064,7 @@ void WebRtcVideoChannel::WebRtcVideoReceiveStream::SetFeedbackParameters( config_.rtp.lntf.enabled = lntf_enabled; stream_->SetLossNotificationEnabled(lntf_enabled); - int nack_history_ms = - nack_enabled ? rtx_time != -1 ? rtx_time : kNackHistoryMs : 0; + int nack_history_ms = nack_enabled ? rtx_time.value_or(kNackHistoryMs) : 0; config_.rtp.nack.rtp_history_ms = nack_history_ms; stream_->SetNackHistory(webrtc::TimeDelta::Millis(nack_history_ms)); } @@ -3375,7 +3374,7 @@ void WebRtcVideoChannel::WebRtcVideoReceiveStream::SetLocalSsrc(uint32_t ssrc) { } WebRtcVideoChannel::VideoCodecSettings::VideoCodecSettings() - : flexfec_payload_type(-1), rtx_payload_type(-1), rtx_time(-1) {} + : flexfec_payload_type(-1), rtx_payload_type(-1) {} bool WebRtcVideoChannel::VideoCodecSettings::operator==( const WebRtcVideoChannel::VideoCodecSettings& other) const { diff --git a/media/engine/webrtc_video_engine.h b/media/engine/webrtc_video_engine.h index 0242bdd9f6..ca49f17736 100644 --- a/media/engine/webrtc_video_engine.h +++ b/media/engine/webrtc_video_engine.h @@ -252,7 +252,7 @@ class WebRtcVideoChannel : public VideoMediaChannel, webrtc::UlpfecConfig ulpfec; int flexfec_payload_type; // -1 if absent. int rtx_payload_type; // -1 if absent. - int rtx_time; // -1 if absent. + absl::optional rtx_time; }; struct ChangedSendParameters { @@ -465,7 +465,7 @@ class WebRtcVideoChannel : public VideoMediaChannel, void SetFeedbackParameters(bool lntf_enabled, bool nack_enabled, webrtc::RtcpMode rtcp_mode, - int rtx_time); + absl::optional rtx_time); void SetRecvParameters(const ChangedRecvParameters& recv_params); void OnFrame(const webrtc::VideoFrame& frame) override;