From b300a9cc05bf9735d735edfeade09216e9068888 Mon Sep 17 00:00:00 2001 From: Mosa Morosev Date: Wed, 19 Feb 2025 12:36:21 +0100 Subject: [PATCH] OpenH264 library enabled in Android Chromium build H264 codec components are included in Chromium build on Android when OpenH264 library is enabled in Chromium media using media_use_openh264 build flag. Bug: chromium:40519162 Change-Id: I4fcc341a7d208b399a294b1f86774860f70f83b6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/372680 Reviewed-by: Mirko Bonadei Commit-Queue: Mirko Bonadei Reviewed-by: Sergey Silkin Cr-Commit-Position: refs/heads/main@{#43940} --- webrtc.gni | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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