H.264: Default flags and pulling in openh264 and ffmpeg.

Defining use_third_party_h264 directly, and indirectly defining use_openh264 (from third_party/openh264) and ffmpeg_branding (from third_party/ffmpeg).
These will be used in a follow-up CL that adds an encoder and decoder implementation.
The flags are added in this CL so that they can be used by trybots/waterfall bots in GN without "Build argument had no effect" errors. Equivalent GYP changes are also added.

BUG=468365

Review URL: https://codereview.webrtc.org/1575913003

Cr-Original-Commit-Position: refs/heads/master@{#11204}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: a9a1d2acaf71281a6f09cd85acb6bc21b02e5ce4
diff --git a/build/common.gypi b/build/common.gypi
index dfa52f2..9fa3ce3 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -123,6 +123,17 @@
     # Enabling this may break interop with Android clients that support H264.
     'use_objc_h264%': 0,
 
+    # Enable this to build H.264 encoder/decoder using third party libraries.
+    # Encoding uses OpenH264 and decoding uses FFmpeg. Because of this, OpenH264
+    # and FFmpeg have to be correctly enabled separately.
+    # - use_openh264=1 is required for OpenH264 targets to be defined.
+    # - ffmpeg_branding=Chrome is one way to support H.264 decoding in FFmpeg.
+    #   FFmpeg can be built with/without H.264 support, see 'ffmpeg_branding'.
+    #   Without it, it compiles but H264DecoderImpl fails to initialize.
+    # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
+    # http://www.openh264.org, https://www.ffmpeg.org/
+    'use_third_party_h264%': 0,  # TODO(hbos): To be used in follow-up CL(s).
+
     'conditions': [
       ['build_with_chromium==1', {
         # Exclude pulse audio on Chromium since its prerequisites don't require
diff --git a/build/webrtc.gni b/build/webrtc.gni
index 31f0ef5..c55f423 100644
--- a/build/webrtc.gni
+++ b/build/webrtc.gni
@@ -90,6 +90,17 @@
   # Enable this to use HW H.264 encoder/decoder on iOS PeerConnections.
   # Enabling this may break interop with Android clients that support H264.
   rtc_use_objc_h264 = false
+
+  # Enable this to build H.264 encoder/decoder using third party libraries.
+  # Encoding uses OpenH264 and decoding uses FFmpeg. Because of this, OpenH264
+  # and FFmpeg have to be correctly enabled separately.
+  # - use_openh264=true is required for OpenH264 targets to be defined.
+  # - ffmpeg_branding="Chrome" is one way to support H.264 decoding in FFmpeg.
+  #   FFmpeg can be built with/without H.264 support, see 'ffmpeg_branding'.
+  #   Without it, it compiles but H264DecoderImpl fails to initialize.
+  # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
+  # http://www.openh264.org, https://www.ffmpeg.org/
+  use_third_party_h264 = false  # TODO(hbos): To be used in follow-up CL(s).
 }
 
 # Make it possible to provide custom locations for some libraries (move these
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
index cbfe8c0..32ac627 100644
--- a/modules/video_coding/BUILD.gn
+++ b/modules/video_coding/BUILD.gn
@@ -136,6 +136,18 @@
   deps = [
     "../../system_wrappers",
   ]
+
+  if (use_third_party_h264) {
+    # Dependency added so that variables use_openh264 and ffmpeg_branding are
+    # recognized build arguments (avoid "Build argument has no effect" error).
+    # The variables and dependencies will be used for real as soon as
+    # https://codereview.webrtc.org/1306813009/ lands. In the meantime, the
+    # build arguments are to be used by waterfall/trybots.
+    deps += [
+      "//third_party/ffmpeg:ffmpeg",
+      "//third_party/openh264:encoder",
+    ]
+  }
 }
 
 # TODO(tkchin): Source set for webrtc_h264_video_toolbox. Currently not