Remove RED/RTX workaround from sender/receiver and VideoEngine2.
In older Chrome versions, the associated payload type in the RTX header
of retransmitted packets was always set to be the original media payload type,
regardless of the actual payload type of the packet. This meant that packets
encapsulated with RED headers had incorrect payload type information in the
RTX header. Due to an assumption in the receiver, this incorrect payload type
information would effectively be undone, leading to a working system.
Albeit working, this behaviour was undesired, and thus removed. In the interim,
several workarounds were introduced to not destroy interop between old and
new Chrome versions:
(1) https://codereview.webrtc.org/1649493004
- If no payload type mapping existed for RED over RTX, the payload type
of the underlying media would be used.
- If RED had been negotiated, received RTX packets would always be
assumed to contain RED.
(2) https://codereview.webrtc.org/1964473002
- If RED was removed from the remote description answer, it would be
disabled in the local receiver as well.
(3) https://codereview.webrtc.org/2033763002
- If RED was negotiated in the SDP, it would always be used, regardless
if ULPFEC was negotiated and used, or not.
Since the Chrome versions that exhibited the original bug now are very old,
this CL removes the workarounds from (1) and (2). In particular, after this
change, we will have the following behaviour:
- We assume that a payload type mapping for RED over RTX always is set.
If this is not the case, the RTX packet is not sent.
- The associated payload type of received RTX packets will always be obeyed.
- The (non)-existence of RED in the remote description does not affect the
local receiver.
The workaround in (3) still needs to exist, in order to interop with receivers
that did not have the workarounds in (1) and (2) removed. The change in (3)
can be removed in a couple of Chrome versions.
TESTED=Using AppRTC between patched Chrome (connected to ethernet) and standard Chrome M54 (connected to lossy internal Google WiFi), with and without FEC turned off using AppRTC flag. Also using "Munge SDP" sample on patched Chrome over loopback interface, with 100ms delay and 5% packet loss simulated using tc.
BUG=webrtc:6650
Review-Url: https://codereview.webrtc.org/2469093003
Cr-Original-Commit-Position: refs/heads/master@{#15038}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: e6f98c7a379aae970e7570ac3cf99e2a21f256c0
diff --git a/video/rtp_stream_receiver.cc b/video/rtp_stream_receiver.cc
index 576543b..138ed84 100644
--- a/video/rtp_stream_receiver.cc
+++ b/video/rtp_stream_receiver.cc
@@ -152,22 +152,15 @@
kv.first);
}
- // If set to true, the RTX payload type mapping supplied in
- // |SetRtxPayloadType| will be used when restoring RTX packets. Without it,
- // RTX packets will always be restored to the last non-RTX packet payload type
- // received.
- // TODO(holmer): When Chrome no longer depends on this being false by default,
- // always use the mapping and remove this whole codepath.
- rtp_payload_registry_.set_use_rtx_payload_mapping_on_restore(
- config_.rtp.use_rtx_payload_mapping_on_restore);
-
if (IsFecEnabled()) {
VideoCodec ulpfec_codec = {};
ulpfec_codec.codecType = kVideoCodecULPFEC;
strncpy(ulpfec_codec.plName, "ulpfec", sizeof(ulpfec_codec.plName));
ulpfec_codec.plType = config_.rtp.ulpfec.ulpfec_payload_type;
RTC_CHECK(SetReceiveCodec(ulpfec_codec));
+ }
+ if (IsRedEnabled()) {
VideoCodec red_codec = {};
red_codec.codecType = kVideoCodecRED;
strncpy(red_codec.plName, "red", sizeof(red_codec.plName));
@@ -178,11 +171,6 @@
config_.rtp.ulpfec.red_rtx_payload_type,
config_.rtp.ulpfec.red_payload_type);
}
- // TODO(brandtr): It doesn't seem that |rtp_rtcp_| is used for sending any
- // RTP packets. Investigate if this is the case, and if so, remove this
- // call, since there are no RTP packets to protect with RED+ULPFEC.
- rtp_rtcp_->SetUlpfecConfig(config_.rtp.ulpfec.red_payload_type,
- config_.rtp.ulpfec.ulpfec_payload_type);
}
if (config_.rtp.rtcp_xr.receiver_reference_time_report)
@@ -339,8 +327,11 @@
}
bool RtpStreamReceiver::IsFecEnabled() const {
- return config_.rtp.ulpfec.red_payload_type != -1 &&
- config_.rtp.ulpfec.ulpfec_payload_type != -1;
+ return config_.rtp.ulpfec.ulpfec_payload_type != -1;
+}
+
+bool RtpStreamReceiver::IsRedEnabled() const {
+ return config_.rtp.ulpfec.red_payload_type != -1;
}
bool RtpStreamReceiver::IsRetransmissionsEnabled() const {