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-Commit-Position: refs/heads/master@{#11204}
diff --git a/.gitignore b/.gitignore
index c043601..b14e175 100644
--- a/.gitignore
+++ b/.gitignore
@@ -91,6 +91,7 @@
/third_party/directxsdk
/third_party/drmemory
/third_party/expat
+/third_party/ffmpeg
/third_party/gaeunit
/third_party/gflags/src
/third_party/google-visualization-python
@@ -121,6 +122,7 @@
/third_party/nss
/third_party/oauth2
/third_party/ocmock
+/third_party/openh264
/third_party/openmax_dl
/third_party/opus
/third_party/proguard
diff --git a/.gn b/.gn
index 4689803..f849ef7 100644
--- a/.gn
+++ b/.gn
@@ -43,6 +43,7 @@
"//build/toolchain/mac/BUILD.gn",
"//build/toolchain/win/BUILD.gn",
"//third_party/boringssl/BUILD.gn",
+ "//third_party/openh264/BUILD.gn",
"//third_party/opus/BUILD.gn",
"//webrtc/modules/video_render/BUILD.gn",
]
diff --git a/setup_links.py b/setup_links.py
index 4ef40ea..492c38b 100755
--- a/setup_links.py
+++ b/setup_links.py
@@ -40,6 +40,7 @@
'third_party/colorama',
'third_party/drmemory',
'third_party/expat',
+ 'third_party/ffmpeg',
'third_party/instrumented_libraries',
'third_party/jsoncpp',
'third_party/libc++-static',
@@ -53,6 +54,7 @@
'third_party/lss',
'third_party/nss',
'third_party/ocmock',
+ 'third_party/openh264',
'third_party/openmax_dl',
'third_party/opus',
'third_party/proguard',
diff --git a/sync_chromium.py b/sync_chromium.py
index 442ddcd..8699396 100755
--- a/sync_chromium.py
+++ b/sync_chromium.py
@@ -31,7 +31,7 @@
# Bump this whenever the algorithm changes and you need bots/devs to re-sync,
# ignoring the .last_sync_chromium file
-SCRIPT_VERSION = 5
+SCRIPT_VERSION = 6
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
CHROMIUM_NO_HISTORY = 'CHROMIUM_NO_HISTORY'
diff --git a/webrtc/build/common.gypi b/webrtc/build/common.gypi
index dfa52f2..9fa3ce3 100644
--- a/webrtc/build/common.gypi
+++ b/webrtc/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/webrtc/build/webrtc.gni b/webrtc/build/webrtc.gni
index 31f0ef5..c55f423 100644
--- a/webrtc/build/webrtc.gni
+++ b/webrtc/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/webrtc/modules/video_coding/BUILD.gn b/webrtc/modules/video_coding/BUILD.gn
index cbfe8c0..32ac627 100644
--- a/webrtc/modules/video_coding/BUILD.gn
+++ b/webrtc/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