diff --git a/webrtc/build/common.gypi b/webrtc/build/common.gypi index 67d5c81313..c4622d451a 100644 --- a/webrtc/build/common.gypi +++ b/webrtc/build/common.gypi @@ -141,17 +141,21 @@ # Enabling this may break interop with Android clients that support H264. 'use_objc_h264%': 0, - # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on - # all platforms except iOS. Because FFmpeg can be built with/without H.264 - # support, |ffmpeg_branding| has to separately be set to a value that - # includes H.264, for example "Chrome". If FFmpeg is built without H.264, - # compilation succeeds but |H264DecoderImpl| fails to initialize. - # See also: |rtc_initialize_ffmpeg|. - # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING. - # http://www.openh264.org, https://www.ffmpeg.org/ - 'rtc_use_h264%': 0, - 'conditions': [ + # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported + # on all platforms except Android and iOS. Because FFmpeg can be built + # with/without H.264 support, |ffmpeg_branding| has to separately be set + # to a value that includes H.264, for example "Chrome". If FFmpeg is built + # without H.264, compilation succeeds but |H264DecoderImpl| fails to + # initialize. See also: |rtc_initialize_ffmpeg|. + # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING. + # http://www.openh264.org, https://www.ffmpeg.org/ + ['proprietary_codecs==1 and OS!="android" and OS!="ios"', { + 'rtc_use_h264%': 1, + }, { + 'rtc_use_h264%': 0, + }], + # FFmpeg must be initialized for |H264DecoderImpl| to work. This can be # done by WebRTC during |H264DecoderImpl::InitDecode| or externally. # FFmpeg must only be initialized once. Projects that initialize FFmpeg diff --git a/webrtc/build/webrtc.gni b/webrtc/build/webrtc.gni index 886b899543..90ec934164 100644 --- a/webrtc/build/webrtc.gni +++ b/webrtc/build/webrtc.gni @@ -7,6 +7,7 @@ # be found in the AUTHORS file in the root of the source tree. import("//build/config/arm.gni") +import("//build/config/features.gni") import("//build/config/mips.gni") import("//build_overrides/webrtc.gni") @@ -92,14 +93,14 @@ declare_args() { rtc_use_objc_h264 = false # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on - # all platforms except iOS. Because FFmpeg can be built with/without H.264 - # support, |ffmpeg_branding| has to separately be set to a value that - # includes H.264, for example "Chrome". If FFmpeg is built without H.264, - # compilation succeeds but |H264DecoderImpl| fails to initialize. - # See also: |rtc_initialize_ffmpeg|. + # all platforms except Android and iOS. Because FFmpeg can be built + # with/without H.264 support, |ffmpeg_branding| has to separately be set to a + # value that includes H.264, for example "Chrome". If FFmpeg is built without + # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize. See + # also: |rtc_initialize_ffmpeg|. # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING. # http://www.openh264.org, https://www.ffmpeg.org/ - rtc_use_h264 = false + rtc_use_h264 = proprietary_codecs && !is_android && !is_ios # FFmpeg must be initialized for |H264DecoderImpl| to work. This can be done # by WebRTC during |H264DecoderImpl::InitDecode| or externally. FFmpeg must