Revert "Move ulpfec, red, and flexfec codec to video engine"

This reverts commit 154ee1fd8547768a49b7d67ce586ef5d3c5d9ebc.

Reason for revert: Breaks AppRTCMobileTest on Android64 (M Nexus5X) at https://build.chromium.org/p/client.webrtc/console

Original change's description:
> Move ulpfec, red, and flexfec codec to video engine
> 
> These codecs are currently being added in the internal encoder factory.
> This means that the new injectable video codec factories will miss them.
> This CL moves adding them into the video engine so that both factory
> types will get them.
> 
> This CL makes a functional change in that RED, ULPFEC, and FlexFec will
> be placed after both the internal and external codecs. Previously,
> it was placed between the internal and external codecs.
> 
> Bug: webrtc:8527
> Change-Id: I5aa7a3ca674f621b17cf3aa095a225c753488e09
> Reviewed-on: https://webrtc-review.googlesource.com/22964
> Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#20700}

TBR=brandtr@webrtc.org,magjed@webrtc.org

Change-Id: I20569ae5aa4e5d794c8f7605ff5d2dd708442ae1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8527
Reviewed-on: https://webrtc-review.googlesource.com/23640
Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20707}
diff --git a/media/engine/internalencoderfactory.cc b/media/engine/internalencoderfactory.cc
index 21640df..fa6783f 100644
--- a/media/engine/internalencoderfactory.cc
+++ b/media/engine/internalencoderfactory.cc
@@ -15,9 +15,24 @@
 #include "modules/video_coding/codecs/h264/include/h264.h"
 #include "modules/video_coding/codecs/vp8/include/vp8.h"
 #include "modules/video_coding/codecs/vp9/include/vp9.h"
+#include "system_wrappers/include/field_trial.h"
 
 namespace cricket {
 
+namespace {
+
+// If this field trial is enabled, the "flexfec-03" codec will be advertised
+// as being supported by the InternalEncoderFactory. This means that
+// "flexfec-03" will appear in the default SDP offer, and we therefore need to
+// be ready to receive FlexFEC packets from the remote. It also means that
+// FlexFEC SSRCs will be generated by MediaSession and added as "a=ssrc:" and
+// "a=ssrc-group:" lines in the local SDP.
+bool IsFlexfecAdvertisedFieldTrialEnabled() {
+  return webrtc::field_trial::IsEnabled("WebRTC-FlexFEC-03-Advertised");
+}
+
+}  // namespace
+
 InternalEncoderFactory::InternalEncoderFactory() {
   supported_codecs_.push_back(VideoCodec(kVp8CodecName));
   if (webrtc::VP9Encoder::IsSupported())
@@ -25,6 +40,19 @@
 
   for (const webrtc::SdpVideoFormat& format : webrtc::SupportedH264Codecs())
     supported_codecs_.push_back(VideoCodec(format));
+
+  supported_codecs_.push_back(VideoCodec(kRedCodecName));
+  supported_codecs_.push_back(VideoCodec(kUlpfecCodecName));
+
+  if (IsFlexfecAdvertisedFieldTrialEnabled()) {
+    VideoCodec flexfec_codec(kFlexfecCodecName);
+    // This value is currently arbitrarily set to 10 seconds. (The unit
+    // is microseconds.) This parameter MUST be present in the SDP, but
+    // we never use the actual value anywhere in our code however.
+    // TODO(brandtr): Consider honouring this value in the sender and receiver.
+    flexfec_codec.SetParam(kFlexfecFmtpRepairWindow, "10000000");
+    supported_codecs_.push_back(flexfec_codec);
+  }
 }
 
 InternalEncoderFactory::~InternalEncoderFactory() {}