diff --git a/webrtc/video/video_send_stream.cc b/webrtc/video/video_send_stream.cc index 4b75f95e06..28ef0038c0 100644 --- a/webrtc/video/video_send_stream.cc +++ b/webrtc/video/video_send_stream.cc @@ -987,6 +987,11 @@ void VideoSendStreamImpl::ConfigureProtection() { auto IsUlpfecEnabled = [&]() { return ulpfec_payload_type >= 0; }; auto DisableUlpfec = [&]() { ulpfec_payload_type = -1; }; + if (webrtc::field_trial::IsEnabled("WebRTC-DisableUlpFecExperiment")) { + LOG(LS_INFO) << "Experiment to disable sending ULPFEC is enabled."; + DisableUlpfec(); + } + // If enabled, FlexFEC takes priority over RED+ULPFEC. if (flexfec_enabled) { // We can safely disable RED here, because if the remote supports FlexFEC, @@ -1045,9 +1050,7 @@ void VideoSendStreamImpl::ConfigureProtection() { true, kMinSendSidePacketHistorySize); // Set RED/ULPFEC information. - for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { - rtp_rtcp->SetUlpfecConfig(red_payload_type, ulpfec_payload_type); - } + rtp_rtcp->SetUlpfecConfig(red_payload_type, ulpfec_payload_type); } // Currently, both ULPFEC and FlexFEC use the same FEC rate calculation logic, diff --git a/webrtc/video/video_send_stream_tests.cc b/webrtc/video/video_send_stream_tests.cc index 194493715e..7a60b765e2 100644 --- a/webrtc/video/video_send_stream_tests.cc +++ b/webrtc/video/video_send_stream_tests.cc @@ -554,6 +554,20 @@ TEST_F(VideoSendStreamTest, SupportsUlpfecWithoutExtensions) { RunBaseTest(&test); } +class VideoSendStreamWithoutUlpfecTest : public VideoSendStreamTest { + protected: + VideoSendStreamWithoutUlpfecTest() + : field_trial_("WebRTC-DisableUlpFecExperiment/Enabled/") {} + + test::ScopedFieldTrials field_trial_; +}; + +TEST_F(VideoSendStreamWithoutUlpfecTest, NoUlpfecIfDisabledThroughFieldTrial) { + std::unique_ptr encoder(VP8Encoder::Create()); + UlpfecObserver test(false, false, true, false, "VP8", encoder.get()); + RunBaseTest(&test); +} + // The FEC scheme used is not efficient for H264, so we should not use RED/FEC // since we'll still have to re-request FEC packets, effectively wasting // bandwidth since the receiver has to wait for FEC retransmissions to determine