diff --git a/call/rtp_video_sender.cc b/call/rtp_video_sender.cc
index 854a18a..5f8d2df 100644
--- a/call/rtp_video_sender.cc
+++ b/call/rtp_video_sender.cc
@@ -197,7 +197,6 @@
     FrameEncryptorInterface* frame_encryptor,
     const CryptoOptions& crypto_options,
     rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
-    bool use_deferred_fec,
     const WebRtcKeyValueConfig& trials) {
   RTC_DCHECK_GT(rtp_config.ssrcs.size(), 0);
 
@@ -245,9 +244,7 @@
     std::unique_ptr<VideoFecGenerator> fec_generator =
         MaybeCreateFecGenerator(clock, rtp_config, suspended_ssrcs, i, trials);
     configuration.fec_generator = fec_generator.get();
-    if (!use_deferred_fec) {
-      video_config.fec_generator = fec_generator.get();
-    }
+    video_config.fec_generator = fec_generator.get();
 
     configuration.rtx_send_ssrc =
         rtp_config.GetRtxSsrcAssociatedWithMediaSsrc(rtp_config.ssrcs[i]);
@@ -341,9 +338,6 @@
           field_trials_.Lookup("WebRTC-UseEarlyLossDetection"),
           "Disabled")),
       has_packet_feedback_(TransportSeqNumExtensionConfigured(rtp_config)),
-      use_deferred_fec_(
-          absl::StartsWith(field_trials_.Lookup("WebRTC-DeferredFecGeneration"),
-                           "Enabled")),
       active_(false),
       module_process_thread_(nullptr),
       suspended_ssrcs_(std::move(suspended_ssrcs)),
@@ -362,7 +356,6 @@
                                           frame_encryptor,
                                           crypto_options,
                                           std::move(frame_transformer),
-                                          use_deferred_fec_,
                                           field_trials_)),
       rtp_config_(rtp_config),
       codec_type_(GetVideoCodecType(rtp_config)),
@@ -855,26 +848,14 @@
   *sent_nack_rate_bps = 0;
   *sent_fec_rate_bps = 0;
   for (const RtpStreamSender& stream : rtp_streams_) {
-    if (use_deferred_fec_) {
-      stream.rtp_rtcp->SetFecProtectionParams(*delta_params, *key_params);
-
-      auto send_bitrate = stream.rtp_rtcp->GetSendRates();
-      *sent_video_rate_bps += send_bitrate[RtpPacketMediaType::kVideo].bps();
-      *sent_fec_rate_bps +=
-          send_bitrate[RtpPacketMediaType::kForwardErrorCorrection].bps();
-      *sent_nack_rate_bps +=
-          send_bitrate[RtpPacketMediaType::kRetransmission].bps();
-    } else {
-      if (stream.fec_generator) {
-        stream.fec_generator->SetProtectionParameters(*delta_params,
-                                                      *key_params);
-        *sent_fec_rate_bps += stream.fec_generator->CurrentFecRate().bps();
-      }
-      *sent_video_rate_bps += stream.sender_video->VideoBitrateSent();
-      *sent_nack_rate_bps +=
-          stream.rtp_rtcp->GetSendRates()[RtpPacketMediaType::kRetransmission]
-              .bps<uint32_t>();
+    if (stream.fec_generator) {
+      stream.fec_generator->SetProtectionParameters(*delta_params, *key_params);
+      *sent_fec_rate_bps += stream.fec_generator->CurrentFecRate().bps();
     }
+    *sent_video_rate_bps += stream.sender_video->VideoBitrateSent();
+    *sent_nack_rate_bps +=
+        stream.rtp_rtcp->GetSendRates()[RtpPacketMediaType::kRetransmission]
+            .bps<uint32_t>();
   }
   return 0;
 }
diff --git a/call/rtp_video_sender.h b/call/rtp_video_sender.h
index e364729..0c277d6 100644
--- a/call/rtp_video_sender.h
+++ b/call/rtp_video_sender.h
@@ -176,7 +176,6 @@
   const bool account_for_packetization_overhead_;
   const bool use_early_loss_detection_;
   const bool has_packet_feedback_;
-  const bool use_deferred_fec_;
 
   // TODO(holmer): Remove crit_ once RtpVideoSender runs on the
   // transport task queue.
diff --git a/modules/pacing/pacing_controller.cc b/modules/pacing/pacing_controller.cc
index 7e7a01b..07e265b 100644
--- a/modules/pacing/pacing_controller.cc
+++ b/modules/pacing/pacing_controller.cc
@@ -441,9 +441,6 @@
         keepalive_data_sent +=
             DataSize::Bytes(packet->payload_size() + packet->padding_size());
         packet_sender_->SendPacket(std::move(packet), PacedPacketInfo());
-        for (auto& packet : packet_sender_->FetchFec()) {
-          EnqueuePacket(std::move(packet));
-        }
       }
       OnPaddingSent(keepalive_data_sent);
     }
@@ -562,11 +559,8 @@
       packet_size += DataSize::Bytes(rtp_packet->headers_size()) +
                      transport_overhead_per_packet_;
     }
-
     packet_sender_->SendPacket(std::move(rtp_packet), pacing_info);
-    for (auto& packet : packet_sender_->FetchFec()) {
-      EnqueuePacket(std::move(packet));
-    }
+
     data_sent += packet_size;
 
     // Send done, update send/process time to the target send time.
diff --git a/modules/pacing/pacing_controller.h b/modules/pacing/pacing_controller.h
index 775fdc9..6e361ae 100644
--- a/modules/pacing/pacing_controller.h
+++ b/modules/pacing/pacing_controller.h
@@ -57,8 +57,6 @@
     virtual ~PacketSender() = default;
     virtual void SendPacket(std::unique_ptr<RtpPacketToSend> packet,
                             const PacedPacketInfo& cluster_info) = 0;
-    // Should be called after each call to SendPacket().
-    virtual std::vector<std::unique_ptr<RtpPacketToSend>> FetchFec() = 0;
     virtual std::vector<std::unique_ptr<RtpPacketToSend>> GeneratePadding(
         DataSize size) = 0;
   };
diff --git a/modules/pacing/pacing_controller_unittest.cc b/modules/pacing/pacing_controller_unittest.cc
index 9194d07..bc4d473 100644
--- a/modules/pacing/pacing_controller_unittest.cc
+++ b/modules/pacing/pacing_controller_unittest.cc
@@ -97,10 +97,6 @@
                int64_t capture_timestamp,
                bool retransmission,
                bool padding));
-  MOCK_METHOD(std::vector<std::unique_ptr<RtpPacketToSend>>,
-              FetchFec,
-              (),
-              (override));
   MOCK_METHOD(size_t, SendPadding, (size_t target_size));
 };
 
@@ -113,11 +109,6 @@
                const PacedPacketInfo& cluster_info),
               (override));
   MOCK_METHOD(std::vector<std::unique_ptr<RtpPacketToSend>>,
-              FetchFec,
-              (),
-              (override));
-
-  MOCK_METHOD(std::vector<std::unique_ptr<RtpPacketToSend>>,
               GeneratePadding,
               (DataSize target_size),
               (override));
@@ -134,10 +125,6 @@
     total_bytes_sent_ += packet->payload_size();
   }
 
-  std::vector<std::unique_ptr<RtpPacketToSend>> FetchFec() override {
-    return {};
-  }
-
   std::vector<std::unique_ptr<RtpPacketToSend>> GeneratePadding(
       DataSize target_size) override {
     size_t num_packets =
@@ -171,10 +158,6 @@
     }
   }
 
-  std::vector<std::unique_ptr<RtpPacketToSend>> FetchFec() override {
-    return {};
-  }
-
   std::vector<std::unique_ptr<RtpPacketToSend>> GeneratePadding(
       DataSize target_size) override {
     // From RTPSender:
@@ -316,7 +299,7 @@
   }
 
   SimulatedClock clock_;
-  ::testing::NiceMock<MockPacingControllerCallback> callback_;
+  MockPacingControllerCallback callback_;
   std::unique_ptr<PacingController> pacer_;
 };
 
@@ -2046,38 +2029,6 @@
   AdvanceTimeAndProcess();
 }
 
-TEST_P(PacingControllerTest, SendsDeferredFecPackets) {
-  ScopedFieldTrials trial("WebRTC-DeferredFecGeneration/Enabled/");
-  SetUp();
-
-  const uint32_t kSsrc = 12345;
-  const uint32_t kFlexSsrc = 54321;
-  uint16_t sequence_number = 1234;
-  uint16_t flexfec_sequence_number = 4321;
-  const size_t kPacketSize = 123;
-
-  // Set pacing rate to 1000 packet/s, no padding.
-  pacer_->SetPacingRates(
-      DataSize::Bytes(1000 * kPacketSize) / TimeDelta::Seconds(1),
-      DataRate::Zero());
-
-  int64_t now = clock_.TimeInMilliseconds();
-  Send(RtpPacketMediaType::kVideo, kSsrc, sequence_number, now, kPacketSize);
-  EXPECT_CALL(callback_, SendPacket(kSsrc, sequence_number, now, false, false));
-  EXPECT_CALL(callback_, FetchFec).WillOnce([&]() {
-    EXPECT_CALL(callback_, SendPacket(kFlexSsrc, flexfec_sequence_number, now,
-                                      false, false));
-    EXPECT_CALL(callback_, FetchFec);
-    std::vector<std::unique_ptr<RtpPacketToSend>> fec_packets;
-    fec_packets.push_back(
-        BuildPacket(RtpPacketMediaType::kForwardErrorCorrection, kFlexSsrc,
-                    flexfec_sequence_number, now, kPacketSize));
-    return fec_packets;
-  });
-  AdvanceTimeAndProcess();
-  AdvanceTimeAndProcess();
-}
-
 INSTANTIATE_TEST_SUITE_P(
     WithAndWithoutIntervalBudget,
     PacingControllerTest,
diff --git a/modules/pacing/packet_router.cc b/modules/pacing/packet_router.cc
index 833c56d..e75b5a3 100644
--- a/modules/pacing/packet_router.cc
+++ b/modules/pacing/packet_router.cc
@@ -42,9 +42,7 @@
       bitrate_bps_(0),
       max_bitrate_bps_(std::numeric_limits<decltype(max_bitrate_bps_)>::max()),
       active_remb_module_(nullptr),
-      transport_seq_(start_transport_seq) {
-  send_thread_checker_.Detach();
-}
+      transport_seq_(start_transport_seq) {}
 
 PacketRouter::~PacketRouter() {
   RTC_DCHECK(send_modules_map_.empty());
@@ -141,7 +139,6 @@
 
 void PacketRouter::SendPacket(std::unique_ptr<RtpPacketToSend> packet,
                               const PacedPacketInfo& cluster_info) {
-  RTC_DCHECK_RUN_ON(&send_thread_checker_);
   TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("webrtc"), "PacketRouter::SendPacket",
                "sequence_number", packet->SequenceNumber(), "rtp_timestamp",
                packet->Timestamp());
@@ -174,18 +171,6 @@
     // properties needed for payload based padding. Cache it for later use.
     last_send_module_ = rtp_module;
   }
-
-  for (auto& packet : rtp_module->FetchFecPackets()) {
-    pending_fec_packets_.push_back(std::move(packet));
-  }
-}
-
-std::vector<std::unique_ptr<RtpPacketToSend>> PacketRouter::FetchFec() {
-  RTC_DCHECK_RUN_ON(&send_thread_checker_);
-  std::vector<std::unique_ptr<RtpPacketToSend>> fec_packets =
-      std::move(pending_fec_packets_);
-  pending_fec_packets_.clear();
-  return fec_packets;
 }
 
 std::vector<std::unique_ptr<RtpPacketToSend>> PacketRouter::GeneratePadding(
diff --git a/modules/pacing/packet_router.h b/modules/pacing/packet_router.h
index b939507..73837f2 100644
--- a/modules/pacing/packet_router.h
+++ b/modules/pacing/packet_router.h
@@ -29,7 +29,6 @@
 #include "rtc_base/constructor_magic.h"
 #include "rtc_base/critical_section.h"
 #include "rtc_base/synchronization/mutex.h"
-#include "rtc_base/synchronization/sequence_checker.h"
 #include "rtc_base/thread_annotations.h"
 
 namespace webrtc {
@@ -58,7 +57,6 @@
 
   void SendPacket(std::unique_ptr<RtpPacketToSend> packet,
                   const PacedPacketInfo& cluster_info) override;
-  std::vector<std::unique_ptr<RtpPacketToSend>> FetchFec() override;
   std::vector<std::unique_ptr<RtpPacketToSend>> GeneratePadding(
       DataSize size) override;
 
@@ -130,10 +128,6 @@
 
   uint64_t transport_seq_ RTC_GUARDED_BY(modules_mutex_);
 
-  SequenceChecker send_thread_checker_;
-  std::vector<std::unique_ptr<RtpPacketToSend>> pending_fec_packets_
-      RTC_GUARDED_BY(send_thread_checker_);
-
   RTC_DISALLOW_COPY_AND_ASSIGN(PacketRouter);
 };
 }  // namespace webrtc
diff --git a/modules/pacing/task_queue_paced_sender_unittest.cc b/modules/pacing/task_queue_paced_sender_unittest.cc
index b02f387..876cd96 100644
--- a/modules/pacing/task_queue_paced_sender_unittest.cc
+++ b/modules/pacing/task_queue_paced_sender_unittest.cc
@@ -44,10 +44,6 @@
                const PacedPacketInfo& cluster_info),
               (override));
   MOCK_METHOD(std::vector<std::unique_ptr<RtpPacketToSend>>,
-              FetchFec,
-              (),
-              (override));
-  MOCK_METHOD(std::vector<std::unique_ptr<RtpPacketToSend>>,
               GeneratePadding,
               (DataSize target_size),
               (override));
diff --git a/modules/rtp_rtcp/include/rtp_rtcp_defines.h b/modules/rtp_rtcp/include/rtp_rtcp_defines.h
index 079c205..1b72236 100644
--- a/modules/rtp_rtcp/include/rtp_rtcp_defines.h
+++ b/modules/rtp_rtcp/include/rtp_rtcp_defines.h
@@ -33,7 +33,6 @@
 
 namespace webrtc {
 class RtpPacket;
-class RtpPacketToSend;
 namespace rtcp {
 class TransportFeedback;
 }
@@ -467,15 +466,5 @@
                             int64_t capture_time_ms,
                             uint32_t ssrc) = 0;
 };
-
-// Interface for a class that can assign RTP sequence numbers for a packet
-// to be sent.
-class SequenceNumberAssigner {
- public:
-  SequenceNumberAssigner() = default;
-  virtual ~SequenceNumberAssigner() = default;
-
-  virtual void AssignSequenceNumber(RtpPacketToSend* packet) = 0;
-};
 }  // namespace webrtc
 #endif  // MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_DEFINES_H_
diff --git a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
index d597b1e..08b38ee 100644
--- a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
+++ b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
@@ -99,15 +99,6 @@
               (RtpPacketToSend * packet, const PacedPacketInfo& pacing_info),
               (override));
   MOCK_METHOD(void,
-              SetFecProtectionParams,
-              (const FecProtectionParams& delta_params,
-               const FecProtectionParams& key_params),
-              (override));
-  MOCK_METHOD(std::vector<std::unique_ptr<RtpPacketToSend>>,
-              FetchFecPackets,
-              (),
-              (override));
-  MOCK_METHOD(void,
               OnPacketsAcknowledged,
               (rtc::ArrayView<const uint16_t>),
               (override));
diff --git a/modules/rtp_rtcp/source/rtp_packet_to_send.h b/modules/rtp_rtcp/source/rtp_packet_to_send.h
index 9aaf9a52..8997bce 100644
--- a/modules/rtp_rtcp/source/rtp_packet_to_send.h
+++ b/modules/rtp_rtcp/source/rtp_packet_to_send.h
@@ -108,15 +108,6 @@
   void set_is_key_frame(bool is_key_frame) { is_key_frame_ = is_key_frame; }
   bool is_key_frame() const { return is_key_frame_; }
 
-  // Indicates if packets should be protected by FEC (Forward Error Correction).
-  void set_fec_protect_packet(bool protect) { fec_protect_packet_ = protect; }
-  bool fec_protect_packet() const { return fec_protect_packet_; }
-
-  // Indicates if packet is using RED encapsulation, in accordance with
-  // https://tools.ietf.org/html/rfc2198
-  void set_is_red(bool is_red) { is_red_ = is_red; }
-  bool is_red() const { return is_red_; }
-
  private:
   int64_t capture_time_ms_ = 0;
   absl::optional<RtpPacketMediaType> packet_type_;
@@ -125,8 +116,6 @@
   std::vector<uint8_t> application_data_;
   bool is_first_packet_of_frame_ = false;
   bool is_key_frame_ = false;
-  bool fec_protect_packet_ = false;
-  bool is_red_ = false;
 };
 
 }  // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index bd58792..f372dbe 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -391,17 +391,6 @@
   return true;
 }
 
-void ModuleRtpRtcpImpl::SetFecProtectionParams(const FecProtectionParams&,
-                                               const FecProtectionParams&) {
-  RTC_NOTREACHED() << "Deferred FEC not supported in deprecated RTP module.";
-}
-
-std::vector<std::unique_ptr<RtpPacketToSend>>
-ModuleRtpRtcpImpl::FetchFecPackets() {
-  RTC_NOTREACHED() << "Deferred FEC not supported in deprecated RTP module.";
-  return {};
-}
-
 void ModuleRtpRtcpImpl::OnPacketsAcknowledged(
     rtc::ArrayView<const uint16_t> sequence_numbers) {
   RTC_DCHECK(rtp_sender_);
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index 1fa57db..989b8d3 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -139,11 +139,6 @@
   bool TrySendPacket(RtpPacketToSend* packet,
                      const PacedPacketInfo& pacing_info) override;
 
-  void SetFecProtectionParams(const FecProtectionParams& delta_params,
-                              const FecProtectionParams& key_params) override;
-
-  std::vector<std::unique_ptr<RtpPacketToSend>> FetchFecPackets() override;
-
   void OnPacketsAcknowledged(
       rtc::ArrayView<const uint16_t> sequence_numbers) override;
 
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
index fc02f4b..e50f72b 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
@@ -42,15 +42,11 @@
     const RtpRtcpInterface::Configuration& config)
     : packet_history(config.clock, config.enable_rtx_padding_prioritization),
       packet_sender(config, &packet_history),
-      non_paced_sender(&packet_sender, this),
+      non_paced_sender(&packet_sender),
       packet_generator(
           config,
           &packet_history,
           config.paced_sender ? config.paced_sender : &non_paced_sender) {}
-void ModuleRtpRtcpImpl2::RtpSenderContext::AssignSequenceNumber(
-    RtpPacketToSend* packet) {
-  packet_generator.AssignSequenceNumber(packet);
-}
 
 ModuleRtpRtcpImpl2::ModuleRtpRtcpImpl2(const Configuration& configuration)
     : rtcp_sender_(configuration),
@@ -400,31 +396,6 @@
   return true;
 }
 
-void ModuleRtpRtcpImpl2::SetFecProtectionParams(
-    const FecProtectionParams& delta_params,
-    const FecProtectionParams& key_params) {
-  RTC_DCHECK(rtp_sender_);
-  rtp_sender_->packet_sender.SetFecProtectionParameters(delta_params,
-                                                        key_params);
-}
-
-std::vector<std::unique_ptr<RtpPacketToSend>>
-ModuleRtpRtcpImpl2::FetchFecPackets() {
-  RTC_DCHECK(rtp_sender_);
-  auto fec_packets = rtp_sender_->packet_sender.FetchFecPackets();
-  if (!fec_packets.empty()) {
-    // Don't assign sequence numbers for FlexFEC packets.
-    const bool generate_sequence_numbers =
-        !rtp_sender_->packet_sender.FlexFecSsrc().has_value();
-    if (generate_sequence_numbers) {
-      for (auto& fec_packet : fec_packets) {
-        rtp_sender_->packet_generator.AssignSequenceNumber(fec_packet.get());
-      }
-    }
-  }
-  return fec_packets;
-}
-
 void ModuleRtpRtcpImpl2::OnPacketsAcknowledged(
     rtc::ArrayView<const uint16_t> sequence_numbers) {
   RTC_DCHECK(rtp_sender_);
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
index 02f82d7..276f88a 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
@@ -145,11 +145,6 @@
   bool TrySendPacket(RtpPacketToSend* packet,
                      const PacedPacketInfo& pacing_info) override;
 
-  void SetFecProtectionParams(const FecProtectionParams& delta_params,
-                              const FecProtectionParams& key_params) override;
-
-  std::vector<std::unique_ptr<RtpPacketToSend>> FetchFecPackets() override;
-
   void OnPacketsAcknowledged(
       rtc::ArrayView<const uint16_t> sequence_numbers) override;
 
@@ -270,9 +265,8 @@
   FRIEND_TEST_ALL_PREFIXES(RtpRtcpImpl2Test, Rtt);
   FRIEND_TEST_ALL_PREFIXES(RtpRtcpImpl2Test, RttForReceiverOnly);
 
-  struct RtpSenderContext : public SequenceNumberAssigner {
+  struct RtpSenderContext {
     explicit RtpSenderContext(const RtpRtcpInterface::Configuration& config);
-    void AssignSequenceNumber(RtpPacketToSend* packet) override;
     // Storage of packets, for retransmissions and padding, if applicable.
     RtpPacketHistory packet_history;
     // Handles final time timestamping/stats/etc and handover to Transport.
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_interface.h b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
index f763da2..440837f 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_interface.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
@@ -293,17 +293,6 @@
   virtual bool TrySendPacket(RtpPacketToSend* packet,
                              const PacedPacketInfo& pacing_info) = 0;
 
-  // Update the FEC protection parameters to use for delta- and key-frames.
-  // Only used when deferred FEC is active.
-  virtual void SetFecProtectionParams(
-      const FecProtectionParams& delta_params,
-      const FecProtectionParams& key_params) = 0;
-
-  // If deferred FEC generation is enabled, this method should be called after
-  // calling TrySendPacket(). Any generated FEC packets will be removed and
-  // returned from the FEC generator.
-  virtual std::vector<std::unique_ptr<RtpPacketToSend>> FetchFecPackets() = 0;
-
   virtual void OnPacketsAcknowledged(
       rtc::ArrayView<const uint16_t> sequence_numbers) = 0;
 
diff --git a/modules/rtp_rtcp/source/rtp_sender_egress.cc b/modules/rtp_rtcp/source/rtp_sender_egress.cc
index d7ce674..c309fc3 100644
--- a/modules/rtp_rtcp/source/rtp_sender_egress.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_egress.cc
@@ -10,7 +10,6 @@
 
 #include "modules/rtp_rtcp/source/rtp_sender_egress.h"
 
-#include <algorithm>
 #include <limits>
 #include <memory>
 #include <utility>
@@ -37,45 +36,21 @@
 }  // namespace
 
 RtpSenderEgress::NonPacedPacketSender::NonPacedPacketSender(
-    RtpSenderEgress* sender,
-    SequenceNumberAssigner* sequence_number_assigner)
-    : transport_sequence_number_(0),
-      sender_(sender),
-      sequence_number_assigner_(sequence_number_assigner) {
-  RTC_DCHECK(sequence_number_assigner_);
-}
+    RtpSenderEgress* sender)
+    : transport_sequence_number_(0), sender_(sender) {}
 RtpSenderEgress::NonPacedPacketSender::~NonPacedPacketSender() = default;
 
 void RtpSenderEgress::NonPacedPacketSender::EnqueuePackets(
     std::vector<std::unique_ptr<RtpPacketToSend>> packets) {
   for (auto& packet : packets) {
-    PrepareForSend(packet.get());
+    if (!packet->SetExtension<TransportSequenceNumber>(
+            ++transport_sequence_number_)) {
+      --transport_sequence_number_;
+    }
+    packet->ReserveExtension<TransmissionOffset>();
+    packet->ReserveExtension<AbsoluteSendTime>();
     sender_->SendPacket(packet.get(), PacedPacketInfo());
   }
-  auto fec_packets = sender_->FetchFecPackets();
-  if (!fec_packets.empty()) {
-    // Don't generate sequence numbers for flexfec, they are already running on
-    // an internally maintained sequence.
-    const bool generate_sequence_numbers = !sender_->FlexFecSsrc().has_value();
-
-    for (auto& packet : fec_packets) {
-      if (generate_sequence_numbers) {
-        sequence_number_assigner_->AssignSequenceNumber(packet.get());
-      }
-      PrepareForSend(packet.get());
-    }
-    EnqueuePackets(std::move(fec_packets));
-  }
-}
-
-void RtpSenderEgress::NonPacedPacketSender::PrepareForSend(
-    RtpPacketToSend* packet) {
-  if (!packet->SetExtension<TransportSequenceNumber>(
-          ++transport_sequence_number_)) {
-    --transport_sequence_number_;
-  }
-  packet->ReserveExtension<TransmissionOffset>();
-  packet->ReserveExtension<AbsoluteSendTime>();
 }
 
 RtpSenderEgress::RtpSenderEgress(const RtpRtcpInterface::Configuration& config,
@@ -93,10 +68,6 @@
       event_log_(config.event_log),
       is_audio_(config.audio),
       need_rtp_packet_infos_(config.need_rtp_packet_infos),
-      fec_generator_(
-          IsEnabled("WebRTC-DeferredFecGeneration", config.field_trials)
-              ? config.fec_generator
-              : nullptr),
       transport_feedback_observer_(config.transport_feedback_callback),
       send_side_delay_observer_(config.send_side_delay_observer),
       send_packet_observer_(config.send_packet_observer),
@@ -164,33 +135,6 @@
           RtpSequenceNumberMap::Info(timestamp, is_first_packet_of_frame,
                                      is_last_packet_of_frame));
     }
-
-    if (fec_generator_ && packet->fec_protect_packet()) {
-      // Deferred fec generation is used, add packet to generator.
-
-      RTC_DCHECK(fec_generator_);
-      RTC_DCHECK(packet->packet_type() == RtpPacketMediaType::kVideo);
-      if (packet->is_red()) {
-        RtpPacketToSend unpacked_packet(*packet);
-
-        const rtc::CopyOnWriteBuffer buffer = packet->Buffer();
-        // Grab media payload type from RED header.
-        const size_t headers_size = packet->headers_size();
-        unpacked_packet.SetPayloadType(buffer[headers_size]);
-
-        // Copy the media payload into the unpacked buffer.
-        uint8_t* payload_buffer =
-            unpacked_packet.SetPayloadSize(packet->payload_size() - 1);
-        std::copy(&packet->payload()[0] + 1,
-                  &packet->payload()[0] + packet->payload_size(),
-                  payload_buffer);
-
-        fec_generator_->AddPacketAndGenerateFec(unpacked_packet);
-      } else {
-        // If not RED encapsulated - we can just insert packet directly.
-        fec_generator_->AddPacketAndGenerateFec(*packet);
-      }
-    }
   }
 
   // Bug webrtc:7859. While FEC is invoked from rtp_sender_video, and not after
@@ -256,8 +200,6 @@
     rtc::CritScope lock(&lock_);
     UpdateRtpStats(*packet);
     media_has_been_sent_ = true;
-    // TODO(sprang): Add support for FEC protecting all header extensions, add
-    // media packet to generator here instead.
   }
 }
 
@@ -340,24 +282,6 @@
   return results;
 }
 
-void RtpSenderEgress::SetFecProtectionParameters(
-    const FecProtectionParams& delta_params,
-    const FecProtectionParams& key_params) {
-  rtc::CritScope lock(&lock_);
-  if (fec_generator_) {
-    fec_generator_->SetProtectionParameters(delta_params, key_params);
-  }
-}
-
-std::vector<std::unique_ptr<RtpPacketToSend>>
-RtpSenderEgress::FetchFecPackets() {
-  rtc::CritScope lock(&lock_);
-  if (fec_generator_) {
-    return fec_generator_->GetFecPackets();
-  }
-  return {};
-}
-
 bool RtpSenderEgress::HasCorrectSsrc(const RtpPacketToSend& packet) const {
   switch (*packet.packet_type()) {
     case RtpPacketMediaType::kAudio:
diff --git a/modules/rtp_rtcp/source/rtp_sender_egress.h b/modules/rtp_rtcp/source/rtp_sender_egress.h
index 3f522b9..a8e033c 100644
--- a/modules/rtp_rtcp/source/rtp_sender_egress.h
+++ b/modules/rtp_rtcp/source/rtp_sender_egress.h
@@ -36,18 +36,15 @@
   // without passing through an actual paced sender.
   class NonPacedPacketSender : public RtpPacketSender {
    public:
-    NonPacedPacketSender(RtpSenderEgress* sender,
-                         SequenceNumberAssigner* sequence_number_assigner);
+    explicit NonPacedPacketSender(RtpSenderEgress* sender);
     virtual ~NonPacedPacketSender();
 
     void EnqueuePackets(
         std::vector<std::unique_ptr<RtpPacketToSend>> packets) override;
 
    private:
-    void PrepareForSend(RtpPacketToSend* packet);
     uint16_t transport_sequence_number_;
     RtpSenderEgress* const sender_;
-    SequenceNumberAssigner* sequence_number_assigner_;
   };
 
   RtpSenderEgress(const RtpRtcpInterface::Configuration& config,
@@ -81,10 +78,6 @@
       rtc::ArrayView<const uint16_t> sequence_numbers) const
       RTC_LOCKS_EXCLUDED(lock_);
 
-  void SetFecProtectionParameters(const FecProtectionParams& delta_params,
-                                  const FecProtectionParams& key_params);
-  std::vector<std::unique_ptr<RtpPacketToSend>> FetchFecPackets();
-
  private:
   // Maps capture time in milliseconds to send-side delay in milliseconds.
   // Send-side delay is the difference between transmission time and capture
@@ -121,7 +114,6 @@
   RtcEventLog* const event_log_;
   const bool is_audio_;
   const bool need_rtp_packet_infos_;
-  VideoFecGenerator* const fec_generator_ RTC_GUARDED_BY(lock_);
 
   TransportFeedbackObserver* const transport_feedback_observer_;
   SendSideDelayObserver* const send_side_delay_observer_;
diff --git a/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_unittest.cc
index 9052e61..12055b5 100644
--- a/modules/rtp_rtcp/source/rtp_sender_unittest.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_unittest.cc
@@ -32,7 +32,6 @@
 #include "modules/rtp_rtcp/source/rtp_sender_egress.h"
 #include "modules/rtp_rtcp/source/rtp_sender_video.h"
 #include "modules/rtp_rtcp/source/rtp_utility.h"
-#include "modules/rtp_rtcp/source/video_fec_generator.h"
 #include "rtc_base/arraysize.h"
 #include "rtc_base/rate_limiter.h"
 #include "rtc_base/strings/string_builder.h"
@@ -141,10 +140,8 @@
 }
 
 struct TestConfig {
-  TestConfig(bool with_overhead, bool deferred_fec)
-      : with_overhead(with_overhead), deferred_fec(deferred_fec) {}
+  explicit TestConfig(bool with_overhead) : with_overhead(with_overhead) {}
   bool with_overhead = false;
-  bool deferred_fec = false;
 };
 
 class MockRtpPacketPacer : public RtpPacketSender {
@@ -214,18 +211,15 @@
 // Mimics ModuleRtpRtcp::RtpSenderContext.
 // TODO(sprang): Split up unit tests and test these components individually
 // wherever possible.
-struct RtpSenderContext : public SequenceNumberAssigner {
+struct RtpSenderContext {
   explicit RtpSenderContext(const RtpRtcpInterface::Configuration& config)
       : packet_history_(config.clock, config.enable_rtx_padding_prioritization),
         packet_sender_(config, &packet_history_),
-        non_paced_sender_(&packet_sender_, this),
+        non_paced_sender_(&packet_sender_),
         packet_generator_(
             config,
             &packet_history_,
             config.paced_sender ? config.paced_sender : &non_paced_sender_) {}
-  void AssignSequenceNumber(RtpPacketToSend* packet) override {
-    packet_generator_.AssignSequenceNumber(packet);
-  }
   RtpPacketHistory packet_history_;
   RtpSenderEgress packet_sender_;
   RtpSenderEgress::NonPacedPacketSender non_paced_sender_;
@@ -234,14 +228,10 @@
 
 class FieldTrialConfig : public WebRtcKeyValueConfig {
  public:
-  FieldTrialConfig()
-      : overhead_enabled_(false),
-        deferred_fec_(false),
-        max_padding_factor_(1200) {}
+  FieldTrialConfig() : overhead_enabled_(false), max_padding_factor_(1200) {}
   ~FieldTrialConfig() override {}
 
   void SetOverHeadEnabled(bool enabled) { overhead_enabled_ = enabled; }
-  void UseDeferredFec(bool enabled) { deferred_fec_ = enabled; }
   void SetMaxPaddingFactor(double factor) { max_padding_factor_ = factor; }
 
   std::string Lookup(absl::string_view key) const override {
@@ -252,15 +242,12 @@
       return ssb.str();
     } else if (key == "WebRTC-SendSideBwe-WithOverhead") {
       return overhead_enabled_ ? "Enabled" : "Disabled";
-    } else if (key == "WebRTC-DeferredFecGeneration") {
-      return deferred_fec_ ? "Enabled" : "Disabled";
     }
     return "";
   }
 
  private:
   bool overhead_enabled_;
-  bool deferred_fec_;
   double max_padding_factor_;
 };
 
@@ -281,7 +268,6 @@
                         &fake_clock_),
         kMarkerBit(true) {
     field_trials_.SetOverHeadEnabled(GetParam().with_overhead);
-    field_trials_.UseDeferredFec(GetParam().deferred_fec);
   }
 
   void SetUp() override { SetUpRtpSender(true, false, false); }
@@ -299,20 +285,12 @@
   void SetUpRtpSender(bool pacer,
                       bool populate_network2,
                       bool always_send_mid_and_rid) {
-    SetUpRtpSender(pacer, populate_network2, always_send_mid_and_rid,
-                   &flexfec_sender_);
-  }
-
-  void SetUpRtpSender(bool pacer,
-                      bool populate_network2,
-                      bool always_send_mid_and_rid,
-                      VideoFecGenerator* fec_generator) {
     RtpRtcpInterface::Configuration config;
     config.clock = &fake_clock_;
     config.outgoing_transport = &transport_;
     config.local_media_ssrc = kSsrc;
     config.rtx_send_ssrc = kRtxSsrc;
-    config.fec_generator = fec_generator;
+    config.fec_generator = &flexfec_sender_;
     config.event_log = &mock_rtc_event_log_;
     config.send_packet_observer = &send_packet_observer_;
     config.retransmission_rate_limiter = &retransmission_rate_limiter_;
@@ -1270,7 +1248,6 @@
   config.event_log = &mock_rtc_event_log_;
   config.send_packet_observer = &send_packet_observer_;
   config.retransmission_rate_limiter = &retransmission_rate_limiter_;
-  config.field_trials = &field_trials_;
   rtp_sender_context_ = std::make_unique<RtpSenderContext>(config);
 
   rtp_sender()->SetSequenceNumber(kSeqNum);
@@ -1281,11 +1258,7 @@
   RTPSenderVideo::Config video_config;
   video_config.clock = &fake_clock_;
   video_config.rtp_sender = rtp_sender();
-  if (!GetParam().deferred_fec) {
-    video_config.fec_generator = &flexfec_sender;
-  }
-  video_config.fec_type = flexfec_sender.GetFecType();
-  video_config.fec_overhead_bytes = flexfec_sender.MaxPacketOverhead();
+  video_config.fec_generator = &flexfec_sender;
   video_config.fec_type = flexfec_sender.GetFecType();
   video_config.fec_overhead_bytes = flexfec_sender.MaxPacketOverhead();
   video_config.field_trials = &field_trials;
@@ -1301,56 +1274,46 @@
   uint16_t flexfec_seq_num;
   RTPVideoHeader video_header;
 
-  std::unique_ptr<RtpPacketToSend> media_packet;
-  std::unique_ptr<RtpPacketToSend> fec_packet;
+    std::unique_ptr<RtpPacketToSend> media_packet;
+    std::unique_ptr<RtpPacketToSend> fec_packet;
 
-  EXPECT_CALL(mock_paced_sender_, EnqueuePackets)
-      .WillOnce([&](std::vector<std::unique_ptr<RtpPacketToSend>> packets) {
-        for (auto& packet : packets) {
-          if (packet->packet_type() == RtpPacketMediaType::kVideo) {
-            EXPECT_EQ(packet->Ssrc(), kSsrc);
-            EXPECT_EQ(packet->SequenceNumber(), kSeqNum);
-            media_packet = std::move(packet);
-
-            if (GetParam().deferred_fec) {
-              // Simulate RtpSenderEgress adding packet to fec generator.
-              flexfec_sender.AddPacketAndGenerateFec(*media_packet);
-              auto fec_packets = flexfec_sender.GetFecPackets();
-              EXPECT_EQ(fec_packets.size(), 1u);
-              fec_packet = std::move(fec_packets[0]);
-              EXPECT_EQ(fec_packet->packet_type(),
+    EXPECT_CALL(mock_paced_sender_, EnqueuePackets)
+        .WillOnce([&](std::vector<std::unique_ptr<RtpPacketToSend>> packets) {
+          for (auto& packet : packets) {
+            if (packet->packet_type() == RtpPacketMediaType::kVideo) {
+              EXPECT_EQ(packet->Ssrc(), kSsrc);
+              EXPECT_EQ(packet->SequenceNumber(), kSeqNum);
+              media_packet = std::move(packet);
+            } else {
+              EXPECT_EQ(packet->packet_type(),
                         RtpPacketMediaType::kForwardErrorCorrection);
-              EXPECT_EQ(fec_packet->Ssrc(), kFlexFecSsrc);
+              EXPECT_EQ(packet->Ssrc(), kFlexFecSsrc);
+              fec_packet = std::move(packet);
             }
-          } else if (packet->packet_type() ==
-                     RtpPacketMediaType::kForwardErrorCorrection) {
-            fec_packet = std::move(packet);
-            EXPECT_EQ(fec_packet->Ssrc(), kFlexFecSsrc);
           }
-        }
-      });
+        });
 
-  video_header.frame_type = VideoFrameType::kVideoFrameKey;
-  EXPECT_TRUE(rtp_sender_video.SendVideo(
-      kMediaPayloadType, kCodecType, kTimestamp,
-      fake_clock_.TimeInMilliseconds(), kPayloadData, nullptr, video_header,
-      kDefaultExpectedRetransmissionTimeMs));
-  ASSERT_TRUE(media_packet != nullptr);
-  ASSERT_TRUE(fec_packet != nullptr);
+    video_header.frame_type = VideoFrameType::kVideoFrameKey;
+    EXPECT_TRUE(rtp_sender_video.SendVideo(
+        kMediaPayloadType, kCodecType, kTimestamp,
+        fake_clock_.TimeInMilliseconds(), kPayloadData, nullptr, video_header,
+        kDefaultExpectedRetransmissionTimeMs));
+    ASSERT_TRUE(media_packet != nullptr);
+    ASSERT_TRUE(fec_packet != nullptr);
 
-  flexfec_seq_num = fec_packet->SequenceNumber();
-  rtp_egress()->SendPacket(media_packet.get(), PacedPacketInfo());
-  rtp_egress()->SendPacket(fec_packet.get(), PacedPacketInfo());
+    flexfec_seq_num = fec_packet->SequenceNumber();
+    rtp_egress()->SendPacket(media_packet.get(), PacedPacketInfo());
+    rtp_egress()->SendPacket(fec_packet.get(), PacedPacketInfo());
 
-  ASSERT_EQ(2, transport_.packets_sent());
-  const RtpPacketReceived& sent_media_packet = transport_.sent_packets_[0];
-  EXPECT_EQ(kMediaPayloadType, sent_media_packet.PayloadType());
-  EXPECT_EQ(kSeqNum, sent_media_packet.SequenceNumber());
-  EXPECT_EQ(kSsrc, sent_media_packet.Ssrc());
-  const RtpPacketReceived& sent_flexfec_packet = transport_.sent_packets_[1];
-  EXPECT_EQ(kFlexfecPayloadType, sent_flexfec_packet.PayloadType());
-  EXPECT_EQ(flexfec_seq_num, sent_flexfec_packet.SequenceNumber());
-  EXPECT_EQ(kFlexFecSsrc, sent_flexfec_packet.Ssrc());
+    ASSERT_EQ(2, transport_.packets_sent());
+    const RtpPacketReceived& sent_media_packet = transport_.sent_packets_[0];
+    EXPECT_EQ(kMediaPayloadType, sent_media_packet.PayloadType());
+    EXPECT_EQ(kSeqNum, sent_media_packet.SequenceNumber());
+    EXPECT_EQ(kSsrc, sent_media_packet.Ssrc());
+    const RtpPacketReceived& sent_flexfec_packet = transport_.sent_packets_[1];
+    EXPECT_EQ(kFlexfecPayloadType, sent_flexfec_packet.PayloadType());
+    EXPECT_EQ(flexfec_seq_num, sent_flexfec_packet.SequenceNumber());
+    EXPECT_EQ(kFlexFecSsrc, sent_flexfec_packet.Ssrc());
 }
 
 TEST_P(RtpSenderTestWithoutPacer, SendFlexfecPackets) {
@@ -1373,7 +1336,6 @@
   config.event_log = &mock_rtc_event_log_;
   config.send_packet_observer = &send_packet_observer_;
   config.retransmission_rate_limiter = &retransmission_rate_limiter_;
-  config.field_trials = &field_trials_;
   rtp_sender_context_ = std::make_unique<RtpSenderContext>(config);
 
   rtp_sender()->SetSequenceNumber(kSeqNum);
@@ -1382,9 +1344,7 @@
   RTPSenderVideo::Config video_config;
   video_config.clock = &fake_clock_;
   video_config.rtp_sender = rtp_sender();
-  if (!GetParam().deferred_fec) {
-    video_config.fec_generator = &flexfec_sender;
-  }
+  video_config.fec_generator = &flexfec_sender;
   video_config.fec_type = flexfec_sender.GetFecType();
   video_config.fec_overhead_bytes = flexfec_sender_.MaxPacketOverhead();
   video_config.field_trials = &field_trials;
@@ -1395,11 +1355,7 @@
   params.fec_rate = 15;
   params.max_fec_frames = 1;
   params.fec_mask_type = kFecMaskRandom;
-  if (GetParam().deferred_fec) {
-    rtp_egress()->SetFecProtectionParameters(params, params);
-  } else {
-    flexfec_sender.SetProtectionParameters(params, params);
-  }
+  flexfec_sender.SetProtectionParameters(params, params);
 
   EXPECT_CALL(mock_rtc_event_log_,
               LogProxy(SameRtcEventTypeAs(RtcEvent::Type::RtpPacketOutgoing)))
@@ -1704,16 +1660,25 @@
                                kNoRtpExtensions, kNoRtpExtensionSizes,
                                nullptr /* rtp_state */, &fake_clock_);
 
-  // Reset |rtp_sender_| to use this FlexFEC instance.
-  SetUpRtpSender(false, false, false, &flexfec_sender);
+  // Reset |rtp_sender_| to use FlexFEC.
+  RtpRtcpInterface::Configuration config;
+  config.clock = &fake_clock_;
+  config.outgoing_transport = &transport_;
+  config.paced_sender = &mock_paced_sender_;
+  config.local_media_ssrc = kSsrc;
+  config.fec_generator = &flexfec_sender;
+  config.event_log = &mock_rtc_event_log_;
+  config.send_packet_observer = &send_packet_observer_;
+  config.retransmission_rate_limiter = &retransmission_rate_limiter_;
+  rtp_sender_context_ = std::make_unique<RtpSenderContext>(config);
+
+  rtp_sender()->SetSequenceNumber(kSeqNum);
 
   FieldTrialBasedConfig field_trials;
   RTPSenderVideo::Config video_config;
   video_config.clock = &fake_clock_;
   video_config.rtp_sender = rtp_sender();
-  if (!GetParam().deferred_fec) {
-    video_config.fec_generator = &flexfec_sender;
-  }
+  video_config.fec_generator = &flexfec_sender;
   video_config.fec_type = flexfec_sender.GetFecType();
   video_config.fec_overhead_bytes = flexfec_sender.MaxPacketOverhead();
   video_config.field_trials = &field_trials;
@@ -1723,15 +1688,12 @@
   params.fec_rate = 15;
   params.max_fec_frames = 1;
   params.fec_mask_type = kFecMaskRandom;
-  if (GetParam().deferred_fec) {
-    rtp_egress()->SetFecProtectionParameters(params, params);
-  } else {
-    flexfec_sender.SetProtectionParameters(params, params);
-  }
+  flexfec_sender.SetProtectionParameters(params, params);
 
   constexpr size_t kNumMediaPackets = 10;
   constexpr size_t kNumFecPackets = kNumMediaPackets;
   constexpr int64_t kTimeBetweenPacketsMs = 10;
+  EXPECT_CALL(mock_paced_sender_, EnqueuePackets).Times(kNumMediaPackets);
   for (size_t i = 0; i < kNumMediaPackets; ++i) {
     RTPVideoHeader video_header;
 
@@ -1749,20 +1711,9 @@
   constexpr size_t kPayloadLength = sizeof(kPayloadData);
   constexpr size_t kPacketLength = kRtpHeaderLength + kFlexfecHeaderLength +
                                    kGenericCodecHeaderLength + kPayloadLength;
-
-  if (GetParam().deferred_fec) {
-    EXPECT_NEAR(
-        kNumFecPackets * kPacketLength * 8 /
-            (kNumFecPackets * kTimeBetweenPacketsMs / 1000.0f),
-        rtp_egress()
-            ->GetSendRates()[RtpPacketMediaType::kForwardErrorCorrection]
-            .bps<double>(),
-        500);
-  } else {
-    EXPECT_NEAR(kNumFecPackets * kPacketLength * 8 /
-                    (kNumFecPackets * kTimeBetweenPacketsMs / 1000.0f),
-                flexfec_sender.CurrentFecRate().bps<double>(), 500);
-  }
+  EXPECT_NEAR(kNumFecPackets * kPacketLength * 8 /
+                  (kNumFecPackets * kTimeBetweenPacketsMs / 1000.0f),
+              flexfec_sender.CurrentFecRate().bps<double>(), 500);
 }
 
 TEST_P(RtpSenderTest, BitrateCallbacks) {
@@ -1910,18 +1861,15 @@
   const uint8_t kUlpfecPayloadType = 97;
   const uint8_t kPayloadType = 127;
   const VideoCodecType kCodecType = VideoCodecType::kVideoCodecGeneric;
-
+  FieldTrialBasedConfig field_trials;
   UlpfecGenerator ulpfec_generator(kRedPayloadType, kUlpfecPayloadType,
                                    &fake_clock_);
-  SetUpRtpSender(false, false, false, &ulpfec_generator);
   RTPSenderVideo::Config video_config;
   video_config.clock = &fake_clock_;
   video_config.rtp_sender = rtp_sender();
-  video_config.field_trials = &field_trials_;
+  video_config.field_trials = &field_trials;
   video_config.red_payload_type = kRedPayloadType;
-  if (!GetParam().deferred_fec) {
-    video_config.fec_generator = &ulpfec_generator;
-  }
+  video_config.fec_generator = &ulpfec_generator;
   video_config.fec_type = ulpfec_generator.GetFecType();
   video_config.fec_overhead_bytes = ulpfec_generator.MaxPacketOverhead();
   RTPSenderVideo rtp_sender_video(video_config);
@@ -1938,11 +1886,7 @@
   fec_params.fec_mask_type = kFecMaskRandom;
   fec_params.fec_rate = 1;
   fec_params.max_fec_frames = 1;
-  if (GetParam().deferred_fec) {
-    rtp_egress()->SetFecProtectionParameters(fec_params, fec_params);
-  } else {
-    ulpfec_generator.SetProtectionParameters(fec_params, fec_params);
-  }
+  ulpfec_generator.SetProtectionParameters(fec_params, fec_params);
   video_header.frame_type = VideoFrameType::kVideoFrameDelta;
   ASSERT_TRUE(rtp_sender_video.SendVideo(kPayloadType, kCodecType, 1234, 4321,
                                          payload, nullptr, video_header,
@@ -2760,16 +2704,12 @@
 
 INSTANTIATE_TEST_SUITE_P(WithAndWithoutOverhead,
                          RtpSenderTest,
-                         ::testing::Values(TestConfig{false, false},
-                                           TestConfig{false, true},
-                                           TestConfig{true, false},
-                                           TestConfig{false, false}));
+                         ::testing::Values(TestConfig{false},
+                                           TestConfig{true}));
 
 INSTANTIATE_TEST_SUITE_P(WithAndWithoutOverhead,
                          RtpSenderTestWithoutPacer,
-                         ::testing::Values(TestConfig{false, false},
-                                           TestConfig{false, true},
-                                           TestConfig{true, false},
-                                           TestConfig{false, false}));
+                         ::testing::Values(TestConfig{false},
+                                           TestConfig{true}));
 
 }  // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_sender_video.cc b/modules/rtp_rtcp/source/rtp_sender_video.cc
index c6a87c6..58a8699 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video.cc
@@ -585,8 +585,8 @@
       if (fec_generator_) {
         fec_generator_->AddPacketAndGenerateFec(*packet);
       } else {
-        // Deferred FEC generation, just mark packet.
-        packet->set_fec_protect_packet(true);
+        // TODO(sprang): When deferred FEC generation is enabled, just mark the
+        // packet as protected here.
       }
     }
 
@@ -594,7 +594,6 @@
       std::unique_ptr<RtpPacketToSend> red_packet(new RtpPacketToSend(*packet));
       BuildRedPayload(*packet, red_packet.get());
       red_packet->SetPayloadType(*red_payload_type_);
-      red_packet->set_is_red(true);
 
       // Send |red_packet| instead of |packet| for allocated sequence number.
       red_packet->set_packet_type(RtpPacketMediaType::kVideo);
diff --git a/modules/rtp_rtcp/source/ulpfec_generator.cc b/modules/rtp_rtcp/source/ulpfec_generator.cc
index 04cb59d..265fa4d 100644
--- a/modules/rtp_rtcp/source/ulpfec_generator.cc
+++ b/modules/rtp_rtcp/source/ulpfec_generator.cc
@@ -230,8 +230,6 @@
     total_fec_size_bytes += red_packet->size();
     red_packet->set_packet_type(RtpPacketMediaType::kForwardErrorCorrection);
     red_packet->set_allow_retransmission(false);
-    red_packet->set_is_red(true);
-    red_packet->set_fec_protect_packet(false);
     fec_packets.push_back(std::move(red_packet));
   }
 
diff --git a/test/scenario/video_stream_unittest.cc b/test/scenario/video_stream_unittest.cc
index 873ef63..37afe1b 100644
--- a/test/scenario/video_stream_unittest.cc
+++ b/test/scenario/video_stream_unittest.cc
@@ -9,7 +9,6 @@
  */
 #include <atomic>
 
-#include "test/field_trial.h"
 #include "test/gtest.h"
 #include "test/scenario/scenario.h"
 
@@ -171,25 +170,6 @@
   EXPECT_GT(video_stats.substreams.begin()->second.rtp_stats.fec.packets, 0u);
 }
 
-TEST(VideoStreamTest, SendsFecWithDeferredFlexFec) {
-  ScopedFieldTrials trial("WebRTC-DeferredFecGeneration/Enabled/");
-  Scenario s;
-  auto route =
-      s.CreateRoutes(s.CreateClient("caller", CallClientConfig()),
-                     {s.CreateSimulationNode([](NetworkSimulationConfig* c) {
-                       c->loss_rate = 0.1;
-                       c->delay = TimeDelta::Millis(100);
-                     })},
-                     s.CreateClient("callee", CallClientConfig()),
-                     {s.CreateSimulationNode(NetworkSimulationConfig())});
-  auto video = s.CreateVideoStream(route->forward(), [&](VideoStreamConfig* c) {
-    c->stream.use_flexfec = true;
-  });
-  s.RunFor(TimeDelta::Seconds(5));
-  VideoSendStream::Stats video_stats = video->send()->GetStats();
-  EXPECT_GT(video_stats.substreams.begin()->second.rtp_stats.fec.packets, 0u);
-}
-
 TEST(VideoStreamTest, ResolutionAdaptsToAvailableBandwidth) {
   // Declared before scenario to avoid use after free.
   std::atomic<size_t> num_qvga_frames_(0);
