diff --git a/webrtc.gni b/webrtc.gni index e33d52902a..cd861f91a0 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -170,18 +170,24 @@ declare_args() { rtc_build_with_neon = (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64" - # 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. + # Enable this to build OpenH264 encoder/FFmpeg decoder. When building WebRTC + # as part of Chromium, this is delegated to `media_use_openh264`. When + # building WebRTC as a standalone library, 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. # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING. # http://www.openh264.org, https://www.ffmpeg.org/ # # Enabling H264 when building with MSVC is currently not supported, see # bugs.webrtc.org/9213#c13 for more info. - rtc_use_h264 = - proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang) + if (build_with_chromium) { + rtc_use_h264 = media_use_openh264 + } else { + rtc_use_h264 = + proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang) + } # Use system OpenH264 rtc_system_openh264 = false