diff --git a/.gitignore b/.gitignore index c043601a7e..b14e1757ab 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 4689803a31..f849ef7281 100644 --- a/.gn +++ b/.gn @@ -43,6 +43,7 @@ exec_script_whitelist = [ "//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 4ef40ead0a..492c38b70e 100755 --- a/setup_links.py +++ b/setup_links.py @@ -40,6 +40,7 @@ DIRECTORIES = [ '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 @@ DIRECTORIES = [ '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 442ddcde91..8699396721 100755 --- a/sync_chromium.py +++ b/sync_chromium.py @@ -31,7 +31,7 @@ import textwrap # 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 dfa52f2cbd..9fa3ce3193 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 31f0ef501b..c55f4230bd 100644 --- a/webrtc/build/webrtc.gni +++ b/webrtc/build/webrtc.gni @@ -90,6 +90,17 @@ declare_args() { # 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 cbfe8c091e..32ac627ed2 100644 --- a/webrtc/modules/video_coding/BUILD.gn +++ b/webrtc/modules/video_coding/BUILD.gn @@ -136,6 +136,18 @@ source_set("webrtc_h264") { 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