From eefba4d644719803b22d8d107ec67674127b8e1b Mon Sep 17 00:00:00 2001 From: Michael Froman Date: Fri, 7 Mar 2025 15:39:51 -0600 Subject: [PATCH] Bug 1952339 - Vendor libwebrtc from b300a9cc05 Upstream commit: https://webrtc.googlesource.com/src/+/b300a9cc05bf9735d735edfeade09216e9068888 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} Differential Revision: https://phabricator.services.mozilla.com/D243941 --- .../libwebrtc/README.mozilla.last-vendor | 4 ++-- .../libwebrtc/moz-patch-stack/0001.patch | 2 +- .../libwebrtc/moz-patch-stack/0030.patch | 10 +++++----- .../libwebrtc/moz-patch-stack/0039.patch | 6 +++--- .../libwebrtc/moz-patch-stack/0051.patch | 4 ++-- .../libwebrtc/moz-patch-stack/0078.patch | 4 ++-- .../libwebrtc/moz-patch-stack/0126.patch | 4 ++-- .../libwebrtc/moz-patch-stack/0127.patch | 6 +++--- .../libwebrtc/moz-patch-stack/0128.patch | 6 +++--- .../libwebrtc/moz-patch-stack/0129.patch | 8 ++++---- .../libwebrtc/moz-patch-stack/0136.patch | 4 ++-- third_party/libwebrtc/webrtc.gni | 20 ++++++++++++------- 12 files changed, 42 insertions(+), 36 deletions(-) diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor index 895e35e74da1..0f2cfff31760 100644 --- a/third_party/libwebrtc/README.mozilla.last-vendor +++ b/third_party/libwebrtc/README.mozilla.last-vendor @@ -1,4 +1,4 @@ # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-03-07T21:38:53.492911+00:00. +libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-03-07T21:39:41.205208+00:00. # base of lastest vendoring -3a3ebb512e +b300a9cc05 diff --git a/third_party/libwebrtc/moz-patch-stack/0001.patch b/third_party/libwebrtc/moz-patch-stack/0001.patch index 63dd20960ae6..6820743d7e4f 100644 --- a/third_party/libwebrtc/moz-patch-stack/0001.patch +++ b/third_party/libwebrtc/moz-patch-stack/0001.patch @@ -1649,7 +1649,7 @@ index 0a9226ef6f..620c1c02f3 100644 vcm_ = nullptr; } diff --git a/webrtc.gni b/webrtc.gni -index e33d52902a..d6628dc52a 100644 +index cd861f91a0..d77a4310f2 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -123,7 +123,7 @@ declare_args() { diff --git a/third_party/libwebrtc/moz-patch-stack/0030.patch b/third_party/libwebrtc/moz-patch-stack/0030.patch index 9ecf24ae5365..038d21da38ac 100644 --- a/third_party/libwebrtc/moz-patch-stack/0030.patch +++ b/third_party/libwebrtc/moz-patch-stack/0030.patch @@ -1310,7 +1310,7 @@ index 7cca46263c..ee2b94ed45 100644 "../api/adaptation:resource_adaptation_api", "../api/environment", diff --git a/webrtc.gni b/webrtc.gni -index d6628dc52a..e635ff0866 100644 +index d77a4310f2..29286c5b95 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -35,6 +35,11 @@ if (is_mac) { @@ -1382,7 +1382,7 @@ index d6628dc52a..e635ff0866 100644 # Experimental: enable use of Android AAudio which requires Android SDK 26 or above # and NDK r16 or above. rtc_enable_android_aaudio = false -@@ -284,7 +291,7 @@ declare_args() { +@@ -290,7 +297,7 @@ declare_args() { rtc_build_json = !build_with_mozilla rtc_build_libsrtp = !build_with_mozilla rtc_build_libvpx = !build_with_mozilla @@ -1391,7 +1391,7 @@ index d6628dc52a..e635ff0866 100644 rtc_build_opus = !build_with_mozilla rtc_build_ssl = !build_with_mozilla -@@ -293,7 +300,7 @@ declare_args() { +@@ -299,7 +306,7 @@ declare_args() { # Chromium uses its own IO handling, so the internal ADM is only built for # standalone WebRTC. @@ -1400,7 +1400,7 @@ index d6628dc52a..e635ff0866 100644 # Set this to true to enable the avx2 support in webrtc. # TODO: Make sure that AVX2 works also for non-clang compilers. -@@ -333,6 +340,9 @@ declare_args() { +@@ -339,6 +346,9 @@ declare_args() { rtc_enable_grpc = rtc_enable_protobuf && (is_linux || is_mac) } @@ -1410,7 +1410,7 @@ index d6628dc52a..e635ff0866 100644 # Make it possible to provide custom locations for some libraries (move these # up into declare_args should we need to actually use them for the GN build). rtc_libvpx_dir = "//third_party/libvpx" -@@ -1199,7 +1209,7 @@ if (is_mac || is_ios) { +@@ -1205,7 +1215,7 @@ if (is_mac || is_ios) { } } diff --git a/third_party/libwebrtc/moz-patch-stack/0039.patch b/third_party/libwebrtc/moz-patch-stack/0039.patch index 8da86c4ad564..2086a3c0d21e 100644 --- a/third_party/libwebrtc/moz-patch-stack/0039.patch +++ b/third_party/libwebrtc/moz-patch-stack/0039.patch @@ -276,7 +276,7 @@ index 059a4dadc1..9e687b8787 100644 config("x11_config") { if (rtc_use_x11_extensions) { diff --git a/webrtc.gni b/webrtc.gni -index e635ff0866..16a1e59e9a 100644 +index 29286c5b95..dc0553d964 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -169,13 +169,13 @@ declare_args() { @@ -293,5 +293,5 @@ index e635ff0866..16a1e59e9a 100644 - (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64" + (target_cpu == "arm" && arm_use_neon) || target_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 + # Enable this to build OpenH264 encoder/FFmpeg decoder. When building WebRTC + # as part of Chromium, this is delegated to `media_use_openh264`. When diff --git a/third_party/libwebrtc/moz-patch-stack/0051.patch b/third_party/libwebrtc/moz-patch-stack/0051.patch index 84911792c999..97631cc26463 100644 --- a/third_party/libwebrtc/moz-patch-stack/0051.patch +++ b/third_party/libwebrtc/moz-patch-stack/0051.patch @@ -74,10 +74,10 @@ index d64ea689bb..c3c6955a7b 100644 #endif // defined(WEBRTC_POSIX) } diff --git a/webrtc.gni b/webrtc.gni -index 16a1e59e9a..933080a544 100644 +index dc0553d964..c67c8d5ea5 100644 --- a/webrtc.gni +++ b/webrtc.gni -@@ -350,7 +350,7 @@ rtc_opus_dir = "//third_party/opus" +@@ -356,7 +356,7 @@ rtc_opus_dir = "//third_party/opus" # Desktop capturer is supported only on Windows, OSX and Linux. rtc_desktop_capture_supported = diff --git a/third_party/libwebrtc/moz-patch-stack/0078.patch b/third_party/libwebrtc/moz-patch-stack/0078.patch index 7cf5dd985fb6..e00aa0e1fe69 100644 --- a/third_party/libwebrtc/moz-patch-stack/0078.patch +++ b/third_party/libwebrtc/moz-patch-stack/0078.patch @@ -10,10 +10,10 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/46fb51c90709be64c 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc.gni b/webrtc.gni -index 933080a544..08736c53ef 100644 +index c67c8d5ea5..93fd8fc8ed 100644 --- a/webrtc.gni +++ b/webrtc.gni -@@ -304,7 +304,7 @@ declare_args() { +@@ -310,7 +310,7 @@ declare_args() { # Set this to true to enable the avx2 support in webrtc. # TODO: Make sure that AVX2 works also for non-clang compilers. diff --git a/third_party/libwebrtc/moz-patch-stack/0126.patch b/third_party/libwebrtc/moz-patch-stack/0126.patch index 7916fc059bcd..b30e49941102 100644 --- a/third_party/libwebrtc/moz-patch-stack/0126.patch +++ b/third_party/libwebrtc/moz-patch-stack/0126.patch @@ -61,7 +61,7 @@ index 7e044d26c3..3053b829f2 100644 rtc_library("encoded_frame") { diff --git a/webrtc.gni b/webrtc.gni -index 08736c53ef..50e7bdf856 100644 +index 93fd8fc8ed..bd0af3a4c5 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -11,7 +11,7 @@ import("//build/config/mips.gni") @@ -73,7 +73,7 @@ index 08736c53ef..50e7bdf856 100644 if (!build_with_chromium && is_component_build) { print("The Gn argument `is_component_build` is currently " + -@@ -487,8 +487,8 @@ all_poison_types = [ +@@ -493,8 +493,8 @@ all_poison_types = [ "software_video_codecs", ] diff --git a/third_party/libwebrtc/moz-patch-stack/0127.patch b/third_party/libwebrtc/moz-patch-stack/0127.patch index 01d213da6552..9572e5dcb5a3 100644 --- a/third_party/libwebrtc/moz-patch-stack/0127.patch +++ b/third_party/libwebrtc/moz-patch-stack/0127.patch @@ -10,10 +10,10 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/45b99d1ba95b46896 1 file changed, 71 insertions(+) diff --git a/webrtc.gni b/webrtc.gni -index 50e7bdf856..fe50741224 100644 +index bd0af3a4c5..33d81920f4 100644 --- a/webrtc.gni +++ b/webrtc.gni -@@ -685,6 +685,36 @@ template("rtc_source_set") { +@@ -691,6 +691,36 @@ template("rtc_source_set") { deps += [ "//third_party/abseil-cpp:absl" ] } } @@ -50,7 +50,7 @@ index 50e7bdf856..fe50741224 100644 } } -@@ -919,6 +949,47 @@ template("rtc_library") { +@@ -925,6 +955,47 @@ template("rtc_library") { deps += [ "//third_party/abseil-cpp:absl" ] } } diff --git a/third_party/libwebrtc/moz-patch-stack/0128.patch b/third_party/libwebrtc/moz-patch-stack/0128.patch index c437590c298e..bab97bb72d1d 100644 --- a/third_party/libwebrtc/moz-patch-stack/0128.patch +++ b/third_party/libwebrtc/moz-patch-stack/0128.patch @@ -874,7 +874,7 @@ index fb107ef1a3..b718fa583d 100644 declare_args() { diff --git a/webrtc.gni b/webrtc.gni -index fe50741224..4466757c0f 100644 +index 33d81920f4..7e6602dfd7 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -5,12 +5,12 @@ @@ -922,7 +922,7 @@ index fe50741224..4466757c0f 100644 } if (build_with_chromium) { -@@ -373,8 +373,8 @@ rtc_common_configs = [ webrtc_root + ":common_config" ] +@@ -379,8 +379,8 @@ rtc_common_configs = [ webrtc_root + ":common_config" ] if (is_mac || is_ios) { if (filter_include(default_compiler_configs, @@ -933,7 +933,7 @@ index fe50741224..4466757c0f 100644 } } -@@ -392,7 +392,7 @@ rtc_common_inherited_config = webrtc_root + ":common_inherited_config" +@@ -398,7 +398,7 @@ rtc_common_inherited_config = webrtc_root + ":common_inherited_config" # Common configs to remove or add in all rtc targets. rtc_remove_configs = [] if (!build_with_chromium && is_clang) { diff --git a/third_party/libwebrtc/moz-patch-stack/0129.patch b/third_party/libwebrtc/moz-patch-stack/0129.patch index 4a4bf9d1899c..66a843543fbc 100644 --- a/third_party/libwebrtc/moz-patch-stack/0129.patch +++ b/third_party/libwebrtc/moz-patch-stack/0129.patch @@ -10,10 +10,10 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/f18c05287ce831369 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/webrtc.gni b/webrtc.gni -index 4466757c0f..254896c313 100644 +index 7e6602dfd7..fe68d3317d 100644 --- a/webrtc.gni +++ b/webrtc.gni -@@ -536,7 +536,7 @@ template("rtc_test") { +@@ -542,7 +542,7 @@ template("rtc_test") { min_sdk_version = 21 target_sdk_version = 24 deps += [ @@ -22,7 +22,7 @@ index 4466757c0f..254896c313 100644 webrtc_root + "sdk/android:native_test_jni_onload", webrtc_root + "sdk/android:base_java", webrtc_root + "test:native_test_java", -@@ -985,11 +985,21 @@ template("rtc_library") { +@@ -991,11 +991,21 @@ template("rtc_library") { modified_deps = [] foreach (dep, deps) { newdep = string_replace(dep, "//third_party/", "//libwebrtc/third_party/") @@ -44,7 +44,7 @@ index 4466757c0f..254896c313 100644 } } -@@ -1027,7 +1037,7 @@ template("rtc_executable") { +@@ -1033,7 +1043,7 @@ template("rtc_executable") { if (is_win) { deps += [ # Give executables the default manifest on Windows (a no-op elsewhere). diff --git a/third_party/libwebrtc/moz-patch-stack/0136.patch b/third_party/libwebrtc/moz-patch-stack/0136.patch index 89fa3f468153..0a126468931a 100644 --- a/third_party/libwebrtc/moz-patch-stack/0136.patch +++ b/third_party/libwebrtc/moz-patch-stack/0136.patch @@ -181,7 +181,7 @@ index 2c83d6614d..87c62f0e99 100644 rtc_library("ssl") { if (!build_with_mozilla) { diff --git a/webrtc.gni b/webrtc.gni -index 254896c313..8fac542d4f 100644 +index fe68d3317d..17306b77b7 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -125,7 +125,7 @@ declare_args() { @@ -193,7 +193,7 @@ index 254896c313..8fac542d4f 100644 # Enable when an external authentication mechanism is used for performing # packet authentication for RTP packets instead of libsrtp. -@@ -341,7 +341,7 @@ declare_args() { +@@ -347,7 +347,7 @@ declare_args() { } # Enable liboam only on non-mozilla builds. diff --git a/third_party/libwebrtc/webrtc.gni b/third_party/libwebrtc/webrtc.gni index 8fac542d4f94..17306b77b768 100644 --- a/third_party/libwebrtc/webrtc.gni +++ b/third_party/libwebrtc/webrtc.gni @@ -177,18 +177,24 @@ declare_args() { rtc_build_with_neon = (target_cpu == "arm" && arm_use_neon) || target_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