commit f65492631f8fa8714d72d09ba3fa5edf3b08bac3
Author: Christoph Moench-Tegeder <cmt@FreeBSD.org>

    regenerate FreeBSD libwebrtc patch for gecko 140

diff --git third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build
index a29aef4b45e5..c193c4232adf 100644
--- third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build
+++ third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("resource_adaptation_api_gn")
diff --git third_party/libwebrtc/api/array_view_gn/moz.build third_party/libwebrtc/api/array_view_gn/moz.build
index 642158f0b8be..994364e58ce4 100644
--- third_party/libwebrtc/api/array_view_gn/moz.build
+++ third_party/libwebrtc/api/array_view_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("array_view_gn")
diff --git third_party/libwebrtc/api/async_dns_resolver_gn/moz.build third_party/libwebrtc/api/async_dns_resolver_gn/moz.build
index c7f482cc2e28..e44aba4a8252 100644
--- third_party/libwebrtc/api/async_dns_resolver_gn/moz.build
+++ third_party/libwebrtc/api/async_dns_resolver_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,120 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -163,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("async_dns_resolver_gn")
diff --git third_party/libwebrtc/api/audio/aec3_config_gn/moz.build third_party/libwebrtc/api/audio/aec3_config_gn/moz.build
index 8113afb08273..123471602ffd 100644
--- third_party/libwebrtc/api/audio/aec3_config_gn/moz.build
+++ third_party/libwebrtc/api/audio/aec3_config_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("aec3_config_gn")
diff --git third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build
index 658f1cf59805..da98391aded6 100644
--- third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build
+++ third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("aec3_factory_gn")
diff --git third_party/libwebrtc/api/audio/audio_device_gn/moz.build third_party/libwebrtc/api/audio/audio_device_gn/moz.build
index 01d48ab0e9bf..3885140cb11b 100644
--- third_party/libwebrtc/api/audio/audio_device_gn/moz.build
+++ third_party/libwebrtc/api/audio/audio_device_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("audio_device_gn")
diff --git third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build
index 95225d12b2f5..fe08226343af 100644
--- third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build
+++ third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,186 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_frame_api_gn")
diff --git third_party/libwebrtc/api/audio/audio_frame_processor_gn/moz.build third_party/libwebrtc/api/audio/audio_frame_processor_gn/moz.build
index 7b23511c9930..a97e948e3a43 100644
--- third_party/libwebrtc/api/audio/audio_frame_processor_gn/moz.build
+++ third_party/libwebrtc/api/audio/audio_frame_processor_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("audio_frame_processor_gn")
diff --git third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build
index d650f934bf12..28f47d4bb60c 100644
--- third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build
+++ third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("audio_mixer_api_gn")
diff --git third_party/libwebrtc/api/audio/audio_processing_gn/moz.build third_party/libwebrtc/api/audio/audio_processing_gn/moz.build
index 4013ba0e53e8..d6bf78db5064 100644
--- third_party/libwebrtc/api/audio/audio_processing_gn/moz.build
+++ third_party/libwebrtc/api/audio/audio_processing_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_processing_gn")
diff --git third_party/libwebrtc/api/audio/audio_processing_statistics_gn/moz.build third_party/libwebrtc/api/audio/audio_processing_statistics_gn/moz.build
index 020423429a5e..de7f6742627a 100644
--- third_party/libwebrtc/api/audio/audio_processing_statistics_gn/moz.build
+++ third_party/libwebrtc/api/audio/audio_processing_statistics_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_processing_statistics_gn")
diff --git third_party/libwebrtc/api/audio/builtin_audio_processing_builder_gn/moz.build third_party/libwebrtc/api/audio/builtin_audio_processing_builder_gn/moz.build
index 9720fc943734..43ee9e3a60aa 100644
--- third_party/libwebrtc/api/audio/builtin_audio_processing_builder_gn/moz.build
+++ third_party/libwebrtc/api/audio/builtin_audio_processing_builder_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("builtin_audio_processing_builder_gn")
diff --git third_party/libwebrtc/api/audio/echo_control_gn/moz.build third_party/libwebrtc/api/audio/echo_control_gn/moz.build
index f554fd6f8241..b068f7739302 100644
--- third_party/libwebrtc/api/audio/echo_control_gn/moz.build
+++ third_party/libwebrtc/api/audio/echo_control_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("echo_control_gn")
diff --git third_party/libwebrtc/api/audio_codecs/L16/audio_decoder_L16_gn/moz.build third_party/libwebrtc/api/audio_codecs/L16/audio_decoder_L16_gn/moz.build
index cc8409b4ab86..ae6f50e873d1 100644
--- third_party/libwebrtc/api/audio_codecs/L16/audio_decoder_L16_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/L16/audio_decoder_L16_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_decoder_L16_gn")
diff --git third_party/libwebrtc/api/audio_codecs/L16/audio_encoder_L16_gn/moz.build third_party/libwebrtc/api/audio_codecs/L16/audio_encoder_L16_gn/moz.build
index 4c7addbccf20..87731b62a8fd 100644
--- third_party/libwebrtc/api/audio_codecs/L16/audio_encoder_L16_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/L16/audio_encoder_L16_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_encoder_L16_gn")
diff --git third_party/libwebrtc/api/audio_codecs/audio_codecs_api_gn/moz.build third_party/libwebrtc/api/audio_codecs/audio_codecs_api_gn/moz.build
index 0cd4e6611370..e1bdc203eda4 100644
--- third_party/libwebrtc/api/audio_codecs/audio_codecs_api_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/audio_codecs_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,186 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_codecs_api_gn")
diff --git third_party/libwebrtc/api/audio_codecs/builtin_audio_decoder_factory_gn/moz.build third_party/libwebrtc/api/audio_codecs/builtin_audio_decoder_factory_gn/moz.build
index 6225ac1f3f3b..1cea1d96da7b 100644
--- third_party/libwebrtc/api/audio_codecs/builtin_audio_decoder_factory_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/builtin_audio_decoder_factory_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
 DEFINES["WEBRTC_USE_BUILTIN_OPUS"] = "1"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("builtin_audio_decoder_factory_gn")
diff --git third_party/libwebrtc/api/audio_codecs/builtin_audio_encoder_factory_gn/moz.build third_party/libwebrtc/api/audio_codecs/builtin_audio_encoder_factory_gn/moz.build
index e37b27978fb1..1532babfe849 100644
--- third_party/libwebrtc/api/audio_codecs/builtin_audio_encoder_factory_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/builtin_audio_encoder_factory_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
 DEFINES["WEBRTC_USE_BUILTIN_OPUS"] = "1"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("builtin_audio_encoder_factory_gn")
diff --git third_party/libwebrtc/api/audio_codecs/g711/audio_decoder_g711_gn/moz.build third_party/libwebrtc/api/audio_codecs/g711/audio_decoder_g711_gn/moz.build
index edebd9ce86d9..05322dea51b6 100644
--- third_party/libwebrtc/api/audio_codecs/g711/audio_decoder_g711_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/g711/audio_decoder_g711_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_decoder_g711_gn")
diff --git third_party/libwebrtc/api/audio_codecs/g711/audio_encoder_g711_gn/moz.build third_party/libwebrtc/api/audio_codecs/g711/audio_encoder_g711_gn/moz.build
index 40dbaf52b249..7863dd9e6633 100644
--- third_party/libwebrtc/api/audio_codecs/g711/audio_encoder_g711_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/g711/audio_encoder_g711_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_encoder_g711_gn")
diff --git third_party/libwebrtc/api/audio_codecs/g722/audio_decoder_g722_gn/moz.build third_party/libwebrtc/api/audio_codecs/g722/audio_decoder_g722_gn/moz.build
index 376963441f83..94f0257efd1e 100644
--- third_party/libwebrtc/api/audio_codecs/g722/audio_decoder_g722_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/g722/audio_decoder_g722_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_decoder_g722_gn")
diff --git third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_config_gn/moz.build third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_config_gn/moz.build
index 982fb48b055c..fabe33115004 100644
--- third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_config_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_config_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("audio_encoder_g722_config_gn")
diff --git third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_gn/moz.build third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_gn/moz.build
index b8593150d582..4d357bd55c31 100644
--- third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_encoder_g722_gn")
diff --git third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_multiopus_gn/moz.build third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_multiopus_gn/moz.build
index bf3eeaa88803..de644f4d586e 100644
--- third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_multiopus_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_multiopus_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,186 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_decoder_multiopus_gn")
diff --git third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_config_gn/moz.build third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_config_gn/moz.build
index 7c069bac99c3..e1b09fbd1410 100644
--- third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_config_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_config_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("audio_decoder_opus_config_gn")
diff --git third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_gn/moz.build third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_gn/moz.build
index d7116c1b25af..d2fdc6c52b17 100644
--- third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_decoder_opus_gn")
diff --git third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_multiopus_gn/moz.build third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_multiopus_gn/moz.build
index 44bd92989657..2e9b48f8a1ca 100644
--- third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_multiopus_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_multiopus_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,186 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_encoder_multiopus_gn")
diff --git third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_config_gn/moz.build third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_config_gn/moz.build
index e434bc36d641..4de657a3de7b 100644
--- third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_config_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_config_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
 DEFINES["WEBRTC_OPUS_VARIABLE_COMPLEXITY"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -49,175 +58,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_encoder_opus_config_gn")
diff --git third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_gn/moz.build third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_gn/moz.build
index ce10e371bb68..f923b1df29e5 100644
--- third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_encoder_opus_gn")
diff --git third_party/libwebrtc/api/audio_codecs/opus_audio_decoder_factory_gn/moz.build third_party/libwebrtc/api/audio_codecs/opus_audio_decoder_factory_gn/moz.build
index 70a8757803e7..3ea74de51e24 100644
--- third_party/libwebrtc/api/audio_codecs/opus_audio_decoder_factory_gn/moz.build
+++ third_party/libwebrtc/api/audio_codecs/opus_audio_decoder_factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("opus_audio_decoder_factory_gn")
diff --git third_party/libwebrtc/api/audio_options_api_gn/moz.build third_party/libwebrtc/api/audio_options_api_gn/moz.build
index 4034a555945f..1bad1c4d1894 100644
--- third_party/libwebrtc/api/audio_options_api_gn/moz.build
+++ third_party/libwebrtc/api/audio_options_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_options_api_gn")
diff --git third_party/libwebrtc/api/bitrate_allocation_gn/moz.build third_party/libwebrtc/api/bitrate_allocation_gn/moz.build
index 5a740fe980cc..00fd8d6b5ab6 100644
--- third_party/libwebrtc/api/bitrate_allocation_gn/moz.build
+++ third_party/libwebrtc/api/bitrate_allocation_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("bitrate_allocation_gn")
diff --git third_party/libwebrtc/api/call_api_gn/moz.build third_party/libwebrtc/api/call_api_gn/moz.build
index af61fa96fb07..934c8061dd1a 100644
--- third_party/libwebrtc/api/call_api_gn/moz.build
+++ third_party/libwebrtc/api/call_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("call_api_gn")
diff --git third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build
index fe1f7bc13e24..5d8265e6ec96 100644
--- third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build
+++ third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("frame_decryptor_interface_gn")
diff --git third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build
index 999863e78f35..acdaa73774aa 100644
--- third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build
+++ third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("frame_encryptor_interface_gn")
diff --git third_party/libwebrtc/api/crypto/options_gn/moz.build third_party/libwebrtc/api/crypto/options_gn/moz.build
index 71008a1b781a..a614772c39d2 100644
--- third_party/libwebrtc/api/crypto/options_gn/moz.build
+++ third_party/libwebrtc/api/crypto/options_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("options_gn")
diff --git third_party/libwebrtc/api/environment/environment_factory_gn/moz.build third_party/libwebrtc/api/environment/environment_factory_gn/moz.build
index 0996db596135..a32dc41fe41f 100644
--- third_party/libwebrtc/api/environment/environment_factory_gn/moz.build
+++ third_party/libwebrtc/api/environment/environment_factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("environment_factory_gn")
diff --git third_party/libwebrtc/api/environment/environment_gn/moz.build third_party/libwebrtc/api/environment/environment_gn/moz.build
index 0b458299cbb0..fc391b227ad3 100644
--- third_party/libwebrtc/api/environment/environment_gn/moz.build
+++ third_party/libwebrtc/api/environment/environment_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("environment_gn")
diff --git third_party/libwebrtc/api/fec_controller_api_gn/moz.build third_party/libwebrtc/api/fec_controller_api_gn/moz.build
index 8256e9ef6578..71085b8a0208 100644
--- third_party/libwebrtc/api/fec_controller_api_gn/moz.build
+++ third_party/libwebrtc/api/fec_controller_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("fec_controller_api_gn")
diff --git third_party/libwebrtc/api/field_trials_registry_gn/moz.build third_party/libwebrtc/api/field_trials_registry_gn/moz.build
index c4645bf682f2..ef81a5cfa0f6 100644
--- third_party/libwebrtc/api/field_trials_registry_gn/moz.build
+++ third_party/libwebrtc/api/field_trials_registry_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("field_trials_registry_gn")
diff --git third_party/libwebrtc/api/field_trials_view_gn/moz.build third_party/libwebrtc/api/field_trials_view_gn/moz.build
index a6f7605626bc..f28ccdfa0f3d 100644
--- third_party/libwebrtc/api/field_trials_view_gn/moz.build
+++ third_party/libwebrtc/api/field_trials_view_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("field_trials_view_gn")
diff --git third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build
index 83b184870ac0..a6ca7af93bd2 100644
--- third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build
+++ third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frame_transformer_interface_gn")
diff --git third_party/libwebrtc/api/function_view_gn/moz.build third_party/libwebrtc/api/function_view_gn/moz.build
index 6c82fcf77a1c..c75f2fa7adb8 100644
--- third_party/libwebrtc/api/function_view_gn/moz.build
+++ third_party/libwebrtc/api/function_view_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("function_view_gn")
diff --git third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build
index c6e7793cb8ce..c5f2988c9cf3 100644
--- third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build
+++ third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("jingle_logging_api_gn")
diff --git third_party/libwebrtc/api/libjingle_peerconnection_api_gn/moz.build third_party/libwebrtc/api/libjingle_peerconnection_api_gn/moz.build
index cc16ead8d247..89ce43a135f6 100644
--- third_party/libwebrtc/api/libjingle_peerconnection_api_gn/moz.build
+++ third_party/libwebrtc/api/libjingle_peerconnection_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("jingle_peerconnection_api_gn")
diff --git third_party/libwebrtc/api/location_gn/moz.build third_party/libwebrtc/api/location_gn/moz.build
index 6d66e59ebb7b..caaa00483d3e 100644
--- third_party/libwebrtc/api/location_gn/moz.build
+++ third_party/libwebrtc/api/location_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("location_gn")
diff --git third_party/libwebrtc/api/make_ref_counted_gn/moz.build third_party/libwebrtc/api/make_ref_counted_gn/moz.build
index 004d1dd755b9..d8144cd18e60 100644
--- third_party/libwebrtc/api/make_ref_counted_gn/moz.build
+++ third_party/libwebrtc/api/make_ref_counted_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("make_ref_counted_gn")
diff --git third_party/libwebrtc/api/media_stream_interface_gn/moz.build third_party/libwebrtc/api/media_stream_interface_gn/moz.build
index 54aa80738e3c..5c0f76f23d55 100644
--- third_party/libwebrtc/api/media_stream_interface_gn/moz.build
+++ third_party/libwebrtc/api/media_stream_interface_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("media_stream_interface_gn")
diff --git third_party/libwebrtc/api/metronome/metronome_gn/moz.build third_party/libwebrtc/api/metronome/metronome_gn/moz.build
index b1b97440e4e4..e9b473ead2b4 100644
--- third_party/libwebrtc/api/metronome/metronome_gn/moz.build
+++ third_party/libwebrtc/api/metronome/metronome_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("metronome_gn")
diff --git third_party/libwebrtc/api/neteq/default_neteq_controller_factory_gn/moz.build third_party/libwebrtc/api/neteq/default_neteq_controller_factory_gn/moz.build
index 31dfa96d1368..3477a521945c 100644
--- third_party/libwebrtc/api/neteq/default_neteq_controller_factory_gn/moz.build
+++ third_party/libwebrtc/api/neteq/default_neteq_controller_factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("default_neteq_controller_factory_gn")
diff --git third_party/libwebrtc/api/neteq/default_neteq_factory_gn/moz.build third_party/libwebrtc/api/neteq/default_neteq_factory_gn/moz.build
index b1226384d12d..1cc4a9137400 100644
--- third_party/libwebrtc/api/neteq/default_neteq_factory_gn/moz.build
+++ third_party/libwebrtc/api/neteq/default_neteq_factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("default_neteq_factory_gn")
diff --git third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build
index 362eb922f20c..3b4f25d48f7a 100644
--- third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build
+++ third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("neteq_api_gn")
diff --git third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build
index aec489d12890..2ce3a755ec00 100644
--- third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build
+++ third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("neteq_controller_api_gn")
diff --git third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build
index 3d4c927a3a69..9b7853205ab1 100644
--- third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build
+++ third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("tick_timer_gn")
diff --git third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build
index bb63e0bd8fea..4a47582dc2b6 100644
--- third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build
+++ third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("network_state_predictor_api_gn")
diff --git third_party/libwebrtc/api/priority_gn/moz.build third_party/libwebrtc/api/priority_gn/moz.build
index 30d291e65442..d29f4153dd41 100644
--- third_party/libwebrtc/api/priority_gn/moz.build
+++ third_party/libwebrtc/api/priority_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("priority_gn")
diff --git third_party/libwebrtc/api/ref_count_gn/moz.build third_party/libwebrtc/api/ref_count_gn/moz.build
index 2c6650dfce0d..905863936e46 100644
--- third_party/libwebrtc/api/ref_count_gn/moz.build
+++ third_party/libwebrtc/api/ref_count_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("ref_count_gn")
diff --git third_party/libwebrtc/api/refcountedbase_gn/moz.build third_party/libwebrtc/api/refcountedbase_gn/moz.build
index b4a1ce1859bd..5a48e0f012c7 100644
--- third_party/libwebrtc/api/refcountedbase_gn/moz.build
+++ third_party/libwebrtc/api/refcountedbase_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("refcountedbase_gn")
diff --git third_party/libwebrtc/api/rtc_error_gn/moz.build third_party/libwebrtc/api/rtc_error_gn/moz.build
index 90474a271986..56a78ea56e76 100644
--- third_party/libwebrtc/api/rtc_error_gn/moz.build
+++ third_party/libwebrtc/api/rtc_error_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_error_gn")
diff --git third_party/libwebrtc/api/rtc_event_log/rtc_event_log_gn/moz.build third_party/libwebrtc/api/rtc_event_log/rtc_event_log_gn/moz.build
index 0b756bd9247e..7ea35cc02aba 100644
--- third_party/libwebrtc/api/rtc_event_log/rtc_event_log_gn/moz.build
+++ third_party/libwebrtc/api/rtc_event_log/rtc_event_log_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,186 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_event_log_gn")
diff --git third_party/libwebrtc/api/rtp_headers_gn/moz.build third_party/libwebrtc/api/rtp_headers_gn/moz.build
index ec592155aca1..eac51ce2434c 100644
--- third_party/libwebrtc/api/rtp_headers_gn/moz.build
+++ third_party/libwebrtc/api/rtp_headers_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtp_headers_gn")
diff --git third_party/libwebrtc/api/rtp_packet_info_gn/moz.build third_party/libwebrtc/api/rtp_packet_info_gn/moz.build
index 5ee810606cb6..ab05d8ade21a 100644
--- third_party/libwebrtc/api/rtp_packet_info_gn/moz.build
+++ third_party/libwebrtc/api/rtp_packet_info_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtp_packet_info_gn")
diff --git third_party/libwebrtc/api/rtp_packet_sender_gn/moz.build third_party/libwebrtc/api/rtp_packet_sender_gn/moz.build
index 02fdfc4bf124..c6285735ed40 100644
--- third_party/libwebrtc/api/rtp_packet_sender_gn/moz.build
+++ third_party/libwebrtc/api/rtp_packet_sender_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rtp_packet_sender_gn")
diff --git third_party/libwebrtc/api/rtp_parameters_gn/moz.build third_party/libwebrtc/api/rtp_parameters_gn/moz.build
index 238e7c67f128..cf15782a7f00 100644
--- third_party/libwebrtc/api/rtp_parameters_gn/moz.build
+++ third_party/libwebrtc/api/rtp_parameters_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,179 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtp_parameters_gn")
diff --git third_party/libwebrtc/api/rtp_sender_interface_gn/moz.build third_party/libwebrtc/api/rtp_sender_interface_gn/moz.build
index 2a7960aae06e..c12e8eb0b3ef 100644
--- third_party/libwebrtc/api/rtp_sender_interface_gn/moz.build
+++ third_party/libwebrtc/api/rtp_sender_interface_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rtp_sender_interface_gn")
diff --git third_party/libwebrtc/api/rtp_sender_setparameters_callback_gn/moz.build third_party/libwebrtc/api/rtp_sender_setparameters_callback_gn/moz.build
index 0930cbd84acb..2c0babe074a3 100644
--- third_party/libwebrtc/api/rtp_sender_setparameters_callback_gn/moz.build
+++ third_party/libwebrtc/api/rtp_sender_setparameters_callback_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtp_sender_setparameters_callback_gn")
diff --git third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build
index 6613c28bb60a..003fe860fd3f 100644
--- third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build
+++ third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rtp_transceiver_direction_gn")
diff --git third_party/libwebrtc/api/scoped_refptr_gn/moz.build third_party/libwebrtc/api/scoped_refptr_gn/moz.build
index b2adf5851e86..593dd7ead65b 100644
--- third_party/libwebrtc/api/scoped_refptr_gn/moz.build
+++ third_party/libwebrtc/api/scoped_refptr_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("scoped_refptr_gn")
diff --git third_party/libwebrtc/api/sequence_checker_gn/moz.build third_party/libwebrtc/api/sequence_checker_gn/moz.build
index 67c1414a8fb4..070132b14c93 100644
--- third_party/libwebrtc/api/sequence_checker_gn/moz.build
+++ third_party/libwebrtc/api/sequence_checker_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("sequence_checker_gn")
diff --git third_party/libwebrtc/api/simulated_network_api_gn/moz.build third_party/libwebrtc/api/simulated_network_api_gn/moz.build
index d01110ffb525..795aecd86879 100644
--- third_party/libwebrtc/api/simulated_network_api_gn/moz.build
+++ third_party/libwebrtc/api/simulated_network_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("simulated_network_api_gn")
diff --git third_party/libwebrtc/api/task_queue/default_task_queue_factory_gn/moz.build third_party/libwebrtc/api/task_queue/default_task_queue_factory_gn/moz.build
index 122718956c48..a4b72e0aadf3 100644
--- third_party/libwebrtc/api/task_queue/default_task_queue_factory_gn/moz.build
+++ third_party/libwebrtc/api/task_queue/default_task_queue_factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("default_task_queue_factory_gn")
diff --git third_party/libwebrtc/api/task_queue/pending_task_safety_flag_gn/moz.build third_party/libwebrtc/api/task_queue/pending_task_safety_flag_gn/moz.build
index 9d8b3cf2f357..6d9600947c8a 100644
--- third_party/libwebrtc/api/task_queue/pending_task_safety_flag_gn/moz.build
+++ third_party/libwebrtc/api/task_queue/pending_task_safety_flag_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("pending_task_safety_flag_gn")
diff --git third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build
index 85ed7df23b34..85068cdc7550 100644
--- third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build
+++ third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("task_queue_gn")
diff --git third_party/libwebrtc/api/transport/bandwidth_estimation_settings_gn/moz.build third_party/libwebrtc/api/transport/bandwidth_estimation_settings_gn/moz.build
index 21696b67b110..3121ac7a6e59 100644
--- third_party/libwebrtc/api/transport/bandwidth_estimation_settings_gn/moz.build
+++ third_party/libwebrtc/api/transport/bandwidth_estimation_settings_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("bandwidth_estimation_settings_gn")
diff --git third_party/libwebrtc/api/transport/bandwidth_usage_gn/moz.build third_party/libwebrtc/api/transport/bandwidth_usage_gn/moz.build
index e7882cb5deca..df0954cb00bc 100644
--- third_party/libwebrtc/api/transport/bandwidth_usage_gn/moz.build
+++ third_party/libwebrtc/api/transport/bandwidth_usage_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("bandwidth_usage_gn")
diff --git third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build
index 555a10902f49..c58892133406 100644
--- third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build
+++ third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("bitrate_settings_gn")
diff --git third_party/libwebrtc/api/transport/datagram_transport_interface_gn/moz.build third_party/libwebrtc/api/transport/datagram_transport_interface_gn/moz.build
index 8c89cd7e38ad..8c928a5e26a1 100644
--- third_party/libwebrtc/api/transport/datagram_transport_interface_gn/moz.build
+++ third_party/libwebrtc/api/transport/datagram_transport_interface_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("datagram_transport_interface_gn")
diff --git third_party/libwebrtc/api/transport/ecn_marking_gn/moz.build third_party/libwebrtc/api/transport/ecn_marking_gn/moz.build
index 598652874c2f..b08c4ae86174 100644
--- third_party/libwebrtc/api/transport/ecn_marking_gn/moz.build
+++ third_party/libwebrtc/api/transport/ecn_marking_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("ecn_marking_gn")
diff --git third_party/libwebrtc/api/transport/field_trial_based_config_gn/moz.build third_party/libwebrtc/api/transport/field_trial_based_config_gn/moz.build
index 9105d8e40b27..cba64e004708 100644
--- third_party/libwebrtc/api/transport/field_trial_based_config_gn/moz.build
+++ third_party/libwebrtc/api/transport/field_trial_based_config_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("field_trial_based_config_gn")
diff --git third_party/libwebrtc/api/transport/goog_cc_gn/moz.build third_party/libwebrtc/api/transport/goog_cc_gn/moz.build
index 3118bc006971..a579189ca56f 100644
--- third_party/libwebrtc/api/transport/goog_cc_gn/moz.build
+++ third_party/libwebrtc/api/transport/goog_cc_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("goog_cc_gn")
diff --git third_party/libwebrtc/api/transport/network_control_gn/moz.build third_party/libwebrtc/api/transport/network_control_gn/moz.build
index 84054a3f0cfc..0840a4bd7daa 100644
--- third_party/libwebrtc/api/transport/network_control_gn/moz.build
+++ third_party/libwebrtc/api/transport/network_control_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("network_control_gn")
diff --git third_party/libwebrtc/api/transport/rtp/corruption_detection_message_gn/moz.build third_party/libwebrtc/api/transport/rtp/corruption_detection_message_gn/moz.build
index a51a68014985..9b4f1222b38e 100644
--- third_party/libwebrtc/api/transport/rtp/corruption_detection_message_gn/moz.build
+++ third_party/libwebrtc/api/transport/rtp/corruption_detection_message_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("corruption_detection_message_gn")
diff --git third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build
index e82fb7517ca6..89beea20aa47 100644
--- third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build
+++ third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("dependency_descriptor_gn")
diff --git third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build
index 5b00f221434f..c0eba9314e7c 100644
--- third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build
+++ third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rtp_source_gn")
diff --git third_party/libwebrtc/api/transport/stun_types_gn/moz.build third_party/libwebrtc/api/transport/stun_types_gn/moz.build
index ec8b1a8ae39f..ae0e9837c2d7 100644
--- third_party/libwebrtc/api/transport/stun_types_gn/moz.build
+++ third_party/libwebrtc/api/transport/stun_types_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("stun_types_gn")
diff --git third_party/libwebrtc/api/transport_api_gn/moz.build third_party/libwebrtc/api/transport_api_gn/moz.build
index f62d79097db6..0ca3c18961d0 100644
--- third_party/libwebrtc/api/transport_api_gn/moz.build
+++ third_party/libwebrtc/api/transport_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("transport_api_gn")
diff --git third_party/libwebrtc/api/units/data_rate_gn/moz.build third_party/libwebrtc/api/units/data_rate_gn/moz.build
index 6543d20d464f..54e7f93d1721 100644
--- third_party/libwebrtc/api/units/data_rate_gn/moz.build
+++ third_party/libwebrtc/api/units/data_rate_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("data_rate_gn")
diff --git third_party/libwebrtc/api/units/data_size_gn/moz.build third_party/libwebrtc/api/units/data_size_gn/moz.build
index bcc4e35cfcb6..770feb1b06c9 100644
--- third_party/libwebrtc/api/units/data_size_gn/moz.build
+++ third_party/libwebrtc/api/units/data_size_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("data_size_gn")
diff --git third_party/libwebrtc/api/units/frequency_gn/moz.build third_party/libwebrtc/api/units/frequency_gn/moz.build
index 1da91b84b933..55e3ba9b1169 100644
--- third_party/libwebrtc/api/units/frequency_gn/moz.build
+++ third_party/libwebrtc/api/units/frequency_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frequency_gn")
diff --git third_party/libwebrtc/api/units/time_delta_gn/moz.build third_party/libwebrtc/api/units/time_delta_gn/moz.build
index 525e75c3d915..e33f5d12403a 100644
--- third_party/libwebrtc/api/units/time_delta_gn/moz.build
+++ third_party/libwebrtc/api/units/time_delta_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("time_delta_gn")
diff --git third_party/libwebrtc/api/units/timestamp_gn/moz.build third_party/libwebrtc/api/units/timestamp_gn/moz.build
index 2a52cfa0984e..9400f8288bad 100644
--- third_party/libwebrtc/api/units/timestamp_gn/moz.build
+++ third_party/libwebrtc/api/units/timestamp_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("timestamp_gn")
diff --git third_party/libwebrtc/api/video/builtin_video_bitrate_allocator_factory_gn/moz.build third_party/libwebrtc/api/video/builtin_video_bitrate_allocator_factory_gn/moz.build
index d28b32f439c1..7348138c0730 100644
--- third_party/libwebrtc/api/video/builtin_video_bitrate_allocator_factory_gn/moz.build
+++ third_party/libwebrtc/api/video/builtin_video_bitrate_allocator_factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("builtin_video_bitrate_allocator_factory_gn")
diff --git third_party/libwebrtc/api/video/corruption_detection_filter_settings_gn/moz.build third_party/libwebrtc/api/video/corruption_detection_filter_settings_gn/moz.build
index 84910bec5b6a..28ddeb5e8675 100644
--- third_party/libwebrtc/api/video/corruption_detection_filter_settings_gn/moz.build
+++ third_party/libwebrtc/api/video/corruption_detection_filter_settings_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("corruption_detection_filter_settings_gn")
diff --git third_party/libwebrtc/api/video/encoded_frame_gn/moz.build third_party/libwebrtc/api/video/encoded_frame_gn/moz.build
index fe7417ed2009..cb2e3e8b1c8c 100644
--- third_party/libwebrtc/api/video/encoded_frame_gn/moz.build
+++ third_party/libwebrtc/api/video/encoded_frame_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("encoded_frame_gn")
diff --git third_party/libwebrtc/api/video/encoded_image_gn/moz.build third_party/libwebrtc/api/video/encoded_image_gn/moz.build
index bfdc38c74288..17c35ae9a249 100644
--- third_party/libwebrtc/api/video/encoded_image_gn/moz.build
+++ third_party/libwebrtc/api/video/encoded_image_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("encoded_image_gn")
diff --git third_party/libwebrtc/api/video/frame_buffer_gn/moz.build third_party/libwebrtc/api/video/frame_buffer_gn/moz.build
index 08a20c36f3b2..588d4beb1a1c 100644
--- third_party/libwebrtc/api/video/frame_buffer_gn/moz.build
+++ third_party/libwebrtc/api/video/frame_buffer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frame_buffer_gn")
diff --git third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build
index 682afa6b23c6..6dfaf4e483c8 100644
--- third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build
+++ third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("recordable_encoded_frame_gn")
diff --git third_party/libwebrtc/api/video/render_resolution_gn/moz.build third_party/libwebrtc/api/video/render_resolution_gn/moz.build
index c572a6cb3edd..57a7f9cbfd11 100644
--- third_party/libwebrtc/api/video/render_resolution_gn/moz.build
+++ third_party/libwebrtc/api/video/render_resolution_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("render_resolution_gn")
diff --git third_party/libwebrtc/api/video/resolution_gn/moz.build third_party/libwebrtc/api/video/resolution_gn/moz.build
index 8100831c4cc7..9e9cad2d3072 100644
--- third_party/libwebrtc/api/video/resolution_gn/moz.build
+++ third_party/libwebrtc/api/video/resolution_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("resolution_gn")
diff --git third_party/libwebrtc/api/video/video_adaptation_gn/moz.build third_party/libwebrtc/api/video/video_adaptation_gn/moz.build
index ebd41d83934c..047f9d1c5018 100644
--- third_party/libwebrtc/api/video/video_adaptation_gn/moz.build
+++ third_party/libwebrtc/api/video/video_adaptation_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_adaptation_gn")
diff --git third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build
index 1b623991d78b..691d665df7ab 100644
--- third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build
+++ third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_bitrate_allocation_gn")
diff --git third_party/libwebrtc/api/video/video_bitrate_allocator_factory_gn/moz.build third_party/libwebrtc/api/video/video_bitrate_allocator_factory_gn/moz.build
index 787eece77e9f..0e4eb3564582 100644
--- third_party/libwebrtc/api/video/video_bitrate_allocator_factory_gn/moz.build
+++ third_party/libwebrtc/api/video/video_bitrate_allocator_factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("video_bitrate_allocator_factory_gn")
diff --git third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build
index e3d9aba8ef3c..fcae0009dd68 100644
--- third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build
+++ third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_bitrate_allocator_gn")
diff --git third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build
index 00627f9fe4bf..48f8135282ff 100644
--- third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build
+++ third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("video_codec_constants_gn")
diff --git third_party/libwebrtc/api/video/video_frame_gn/moz.build third_party/libwebrtc/api/video/video_frame_gn/moz.build
index 4aa343b85d29..d5883b13bee8 100644
--- third_party/libwebrtc/api/video/video_frame_gn/moz.build
+++ third_party/libwebrtc/api/video/video_frame_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -55,186 +64,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_frame_gn")
diff --git third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build
index 4951e4edce85..c4728ecf1200 100644
--- third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build
+++ third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -51,186 +60,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_frame_i010_gn")
diff --git third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build
index e00d025ec821..ef2f74bc0852 100644
--- third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build
+++ third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_frame_metadata_gn")
diff --git third_party/libwebrtc/api/video/video_frame_type_gn/moz.build third_party/libwebrtc/api/video/video_frame_type_gn/moz.build
index f09aa8024ef8..3569618dc00d 100644
--- third_party/libwebrtc/api/video/video_frame_type_gn/moz.build
+++ third_party/libwebrtc/api/video/video_frame_type_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("video_frame_type_gn")
diff --git third_party/libwebrtc/api/video/video_layers_allocation_gn/moz.build third_party/libwebrtc/api/video/video_layers_allocation_gn/moz.build
index b9a5bd46571c..de45a2318e42 100644
--- third_party/libwebrtc/api/video/video_layers_allocation_gn/moz.build
+++ third_party/libwebrtc/api/video/video_layers_allocation_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("video_layers_allocation_gn")
diff --git third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build
index 079848bb358b..0a20b46f6c88 100644
--- third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build
+++ third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,186 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_rtp_headers_gn")
diff --git third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build
index 5bc79f430bae..1075c82f0415 100644
--- third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build
+++ third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("video_stream_encoder_gn")
diff --git third_party/libwebrtc/api/video_codecs/bitstream_parser_api_gn/moz.build third_party/libwebrtc/api/video_codecs/bitstream_parser_api_gn/moz.build
index 819a8c287dfc..1282b96a12d0 100644
--- third_party/libwebrtc/api/video_codecs/bitstream_parser_api_gn/moz.build
+++ third_party/libwebrtc/api/video_codecs/bitstream_parser_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("bitstream_parser_api_gn")
diff --git third_party/libwebrtc/api/video_codecs/builtin_video_decoder_factory_gn/moz.build third_party/libwebrtc/api/video_codecs/builtin_video_decoder_factory_gn/moz.build
index 50fb2e553c51..497c1a3e5ea7 100644
--- third_party/libwebrtc/api/video_codecs/builtin_video_decoder_factory_gn/moz.build
+++ third_party/libwebrtc/api/video_codecs/builtin_video_decoder_factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("builtin_video_decoder_factory_gn")
diff --git third_party/libwebrtc/api/video_codecs/rtc_software_fallback_wrappers_gn/moz.build third_party/libwebrtc/api/video_codecs/rtc_software_fallback_wrappers_gn/moz.build
index 8336bf0f9eba..9a07248499a2 100644
--- third_party/libwebrtc/api/video_codecs/rtc_software_fallback_wrappers_gn/moz.build
+++ third_party/libwebrtc/api/video_codecs/rtc_software_fallback_wrappers_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,191 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_software_fallback_wrappers_gn")
diff --git third_party/libwebrtc/api/video_codecs/scalability_mode_gn/moz.build third_party/libwebrtc/api/video_codecs/scalability_mode_gn/moz.build
index 408cb931cfea..527f3b0ba68f 100644
--- third_party/libwebrtc/api/video_codecs/scalability_mode_gn/moz.build
+++ third_party/libwebrtc/api/video_codecs/scalability_mode_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("scalability_mode_gn")
diff --git third_party/libwebrtc/api/video_codecs/video_codecs_api_gn/moz.build third_party/libwebrtc/api/video_codecs/video_codecs_api_gn/moz.build
index 53356c361021..9cef4b9a8a47 100644
--- third_party/libwebrtc/api/video_codecs/video_codecs_api_gn/moz.build
+++ third_party/libwebrtc/api/video_codecs/video_codecs_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -54,186 +63,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_codecs_api_gn")
diff --git third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_gn/moz.build third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_gn/moz.build
index 2daf90b4f83b..ea0857484892 100644
--- third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_gn/moz.build
+++ third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("video_encoder_factory_template_gn")
diff --git third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libaom_av1_adapter_gn/moz.build third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libaom_av1_adapter_gn/moz.build
index dfb4ccbb2c51..9231cdb1708f 100644
--- third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libaom_av1_adapter_gn/moz.build
+++ third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libaom_av1_adapter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,123 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -166,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("video_encoder_factory_template_libaom_av1_adapter_gn")
diff --git third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter_gn/moz.build third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter_gn/moz.build
index 8f2b2d4c394b..2e032e933f4d 100644
--- third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter_gn/moz.build
+++ third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,124 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -167,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("video_encoder_factory_template_libvpx_vp8_adapter_gn")
diff --git third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp9_adapter_gn/moz.build third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp9_adapter_gn/moz.build
index 1262d9c963ac..feb340bc6ffa 100644
--- third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp9_adapter_gn/moz.build
+++ third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp9_adapter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,124 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -167,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("video_encoder_factory_template_libvpx_vp9_adapter_gn")
diff --git third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_open_h264_adapter_gn/moz.build third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_open_h264_adapter_gn/moz.build
index 37ddca0609eb..50eb54ea4186 100644
--- third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_open_h264_adapter_gn/moz.build
+++ third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_open_h264_adapter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,124 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -167,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("video_encoder_factory_template_open_h264_adapter_gn")
diff --git third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory_gn/moz.build third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory_gn/moz.build
index ebc185abb114..3b7a135fe174 100644
--- third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory_gn/moz.build
+++ third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("vp8_temporal_layers_factory_gn")
diff --git third_party/libwebrtc/api/video_track_source_constraints_gn/moz.build third_party/libwebrtc/api/video_track_source_constraints_gn/moz.build
index 933524efdac5..7ec1ae1523bd 100644
--- third_party/libwebrtc/api/video_track_source_constraints_gn/moz.build
+++ third_party/libwebrtc/api/video_track_source_constraints_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("video_track_source_constraints_gn")
diff --git third_party/libwebrtc/audio/audio_gn/moz.build third_party/libwebrtc/audio/audio_gn/moz.build
index 1e33a79591e5..1423654999b3 100644
--- third_party/libwebrtc/audio/audio_gn/moz.build
+++ third_party/libwebrtc/audio/audio_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -56,191 +65,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_gn")
diff --git third_party/libwebrtc/audio/utility/audio_frame_operations_gn/moz.build third_party/libwebrtc/audio/utility/audio_frame_operations_gn/moz.build
index a072faa0e703..b021c5c974d6 100644
--- third_party/libwebrtc/audio/utility/audio_frame_operations_gn/moz.build
+++ third_party/libwebrtc/audio/utility/audio_frame_operations_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,190 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_frame_operations_gn")
diff --git third_party/libwebrtc/call/adaptation/resource_adaptation_gn/moz.build third_party/libwebrtc/call/adaptation/resource_adaptation_gn/moz.build
index a16854c0cbf3..10c7a4ac89a7 100644
--- third_party/libwebrtc/call/adaptation/resource_adaptation_gn/moz.build
+++ third_party/libwebrtc/call/adaptation/resource_adaptation_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -53,191 +62,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("resource_adaptation_gn")
diff --git third_party/libwebrtc/call/audio_sender_interface_gn/moz.build third_party/libwebrtc/call/audio_sender_interface_gn/moz.build
index 24568a31a210..e88cc584182f 100644
--- third_party/libwebrtc/call/audio_sender_interface_gn/moz.build
+++ third_party/libwebrtc/call/audio_sender_interface_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("audio_sender_interface_gn")
diff --git third_party/libwebrtc/call/bitrate_allocator_gn/moz.build third_party/libwebrtc/call/bitrate_allocator_gn/moz.build
index ca42c673672b..a9b6fcefbad9 100644
--- third_party/libwebrtc/call/bitrate_allocator_gn/moz.build
+++ third_party/libwebrtc/call/bitrate_allocator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("bitrate_allocator_gn")
diff --git third_party/libwebrtc/call/bitrate_configurator_gn/moz.build third_party/libwebrtc/call/bitrate_configurator_gn/moz.build
index 2d0f74ea355e..b2182b8b5ce4 100644
--- third_party/libwebrtc/call/bitrate_configurator_gn/moz.build
+++ third_party/libwebrtc/call/bitrate_configurator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("bitrate_configurator_gn")
diff --git third_party/libwebrtc/call/call_gn/moz.build third_party/libwebrtc/call/call_gn/moz.build
index 987aff418d68..38c79be10cdc 100644
--- third_party/libwebrtc/call/call_gn/moz.build
+++ third_party/libwebrtc/call/call_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,191 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("call_gn")
diff --git third_party/libwebrtc/call/call_interfaces_gn/moz.build third_party/libwebrtc/call/call_interfaces_gn/moz.build
index 3147c1e5f11a..485e219e783d 100644
--- third_party/libwebrtc/call/call_interfaces_gn/moz.build
+++ third_party/libwebrtc/call/call_interfaces_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -50,191 +59,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("call_interfaces_gn")
diff --git third_party/libwebrtc/call/payload_type_gn/moz.build third_party/libwebrtc/call/payload_type_gn/moz.build
index 373d925f861d..101b856cff86 100644
--- third_party/libwebrtc/call/payload_type_gn/moz.build
+++ third_party/libwebrtc/call/payload_type_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("payload_type_gn")
diff --git third_party/libwebrtc/call/payload_type_picker_gn/moz.build third_party/libwebrtc/call/payload_type_picker_gn/moz.build
index f6525a6416ce..3c2fd78fd486 100644
--- third_party/libwebrtc/call/payload_type_picker_gn/moz.build
+++ third_party/libwebrtc/call/payload_type_picker_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("payload_type_picker_gn")
diff --git third_party/libwebrtc/call/receive_stream_interface_gn/moz.build third_party/libwebrtc/call/receive_stream_interface_gn/moz.build
index 67bf072556e5..6c2b07cf373d 100644
--- third_party/libwebrtc/call/receive_stream_interface_gn/moz.build
+++ third_party/libwebrtc/call/receive_stream_interface_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,123 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -166,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("receive_stream_interface_gn")
diff --git third_party/libwebrtc/call/rtp_interfaces_gn/moz.build third_party/libwebrtc/call/rtp_interfaces_gn/moz.build
index 5204bc7ce3ea..ee28e9bcacc4 100644
--- third_party/libwebrtc/call/rtp_interfaces_gn/moz.build
+++ third_party/libwebrtc/call/rtp_interfaces_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtp_interfaces_gn")
diff --git third_party/libwebrtc/call/rtp_receiver_gn/moz.build third_party/libwebrtc/call/rtp_receiver_gn/moz.build
index c38e16384766..ce6c252179bd 100644
--- third_party/libwebrtc/call/rtp_receiver_gn/moz.build
+++ third_party/libwebrtc/call/rtp_receiver_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,191 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtp_receiver_gn")
diff --git third_party/libwebrtc/call/rtp_sender_gn/moz.build third_party/libwebrtc/call/rtp_sender_gn/moz.build
index 5290b5209c1d..5fe9f7707ed5 100644
--- third_party/libwebrtc/call/rtp_sender_gn/moz.build
+++ third_party/libwebrtc/call/rtp_sender_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,191 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtp_sender_gn")
diff --git third_party/libwebrtc/call/version_gn/moz.build third_party/libwebrtc/call/version_gn/moz.build
index 96da557651b8..d51b86338e8c 100644
--- third_party/libwebrtc/call/version_gn/moz.build
+++ third_party/libwebrtc/call/version_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("version_gn")
diff --git third_party/libwebrtc/call/video_receive_stream_api_gn/moz.build third_party/libwebrtc/call/video_receive_stream_api_gn/moz.build
index a8f4e7feca35..22dc8ac49790 100644
--- third_party/libwebrtc/call/video_receive_stream_api_gn/moz.build
+++ third_party/libwebrtc/call/video_receive_stream_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_receive_stream_api_gn")
diff --git third_party/libwebrtc/call/video_send_stream_api_gn/moz.build third_party/libwebrtc/call/video_send_stream_api_gn/moz.build
index e61cdfdf0b7f..f7955154d619 100644
--- third_party/libwebrtc/call/video_send_stream_api_gn/moz.build
+++ third_party/libwebrtc/call/video_send_stream_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_send_stream_api_gn")
diff --git third_party/libwebrtc/common_audio/common_audio_avx2_gn/moz.build third_party/libwebrtc/common_audio/common_audio_avx2_gn/moz.build
index 1d91ddd6d2db..d4119282e31e 100644
--- third_party/libwebrtc/common_audio/common_audio_avx2_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_avx2_gn/moz.build
@@ -18,12 +18,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_AVX2"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -51,134 +60,16 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
     DEFINES["_DEBUG"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["TARGET_CPU"] == "x86":
 
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+    DEFINES["USE_X11"] = "1"
 
 Library("common_audio_avx2_gn")
diff --git third_party/libwebrtc/common_audio/common_audio_c_arm_asm_gn/moz.build third_party/libwebrtc/common_audio/common_audio_c_arm_asm_gn/moz.build
index f7215df5b93f..ca8a3e39e485 100644
--- third_party/libwebrtc/common_audio/common_audio_c_arm_asm_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_c_arm_asm_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,113 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-    SOURCES += [
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse_arm.S",
-        "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12_armv7.S"
-    ]
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -156,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("common_audio_c_arm_asm_gn")
diff --git third_party/libwebrtc/common_audio/common_audio_c_gn/moz.build third_party/libwebrtc/common_audio/common_audio_c_gn/moz.build
index 48b33b0a39e0..df61b43a1494 100644
--- third_party/libwebrtc/common_audio/common_audio_c_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_c_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -81,114 +90,12 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
+    DEFINES["_DEBUG"] = True
 
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_fft.c"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse.c",
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_fft.c",
-        "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12.c"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse.c",
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_fft.c",
-        "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12.c"
-    ]
+if CONFIG["TARGET_CPU"] == "aarch64":
 
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["WEBRTC_ARCH_ARM64"] = True
+    DEFINES["WEBRTC_HAS_NEON"] = True
 
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse.c",
@@ -196,25 +103,8 @@ if CONFIG["OS_TARGET"] == "WINNT":
         "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12.c"
     ]
 
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
 if CONFIG["TARGET_CPU"] == "loongarch64":
 
-    DEFINES["_GNU_SOURCE"] = True
-
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse.c",
         "/third_party/libwebrtc/common_audio/signal_processing/complex_fft.c",
@@ -225,7 +115,6 @@ if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     SOURCES += [
         "/third_party/libwebrtc/common_audio/signal_processing/resample_by_2_mips.c"
@@ -242,8 +131,6 @@ if CONFIG["TARGET_CPU"] == "mips32":
 
 if CONFIG["TARGET_CPU"] == "mips64":
 
-    DEFINES["_GNU_SOURCE"] = True
-
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse.c",
         "/third_party/libwebrtc/common_audio/signal_processing/complex_fft.c",
@@ -258,88 +145,21 @@ if CONFIG["TARGET_CPU"] == "ppc64":
         "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12.c"
     ]
 
-if CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "aarch64":
+if CONFIG["TARGET_CPU"] == "riscv64":
 
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse.c",
+        "/third_party/libwebrtc/common_audio/signal_processing/complex_fft.c",
         "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12.c"
     ]
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["TARGET_CPU"] == "x86":
 
     CFLAGS += [
         "-msse2"
     ]
 
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse.c",
-        "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12.c"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse.c",
-        "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12.c"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse.c",
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_fft.c",
-        "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12.c"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_fft.c"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "riscv64":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse.c",
@@ -347,13 +167,9 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "riscv64":
         "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12.c"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    CFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse.c",
@@ -361,14 +177,8 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
         "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12.c"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_bit_reverse.c",
-        "/third_party/libwebrtc/common_audio/signal_processing/complex_fft.c",
-        "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12.c"
-    ]
+    DEFINES["USE_X11"] = "1"
 
 Library("common_audio_c_gn")
diff --git third_party/libwebrtc/common_audio/common_audio_cc_gn/moz.build third_party/libwebrtc/common_audio/common_audio_cc_gn/moz.build
index 53b9acf53b42..f32a57a8e243 100644
--- third_party/libwebrtc/common_audio/common_audio_cc_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_cc_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("common_audio_cc_gn")
diff --git third_party/libwebrtc/common_audio/common_audio_gn/moz.build third_party/libwebrtc/common_audio/common_audio_gn/moz.build
index 8c05ef9ae01e..596e68a80c5e 100644
--- third_party/libwebrtc/common_audio/common_audio_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -57,190 +66,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("common_audio_gn")
diff --git third_party/libwebrtc/common_audio/common_audio_neon_c_gn/moz.build third_party/libwebrtc/common_audio/common_audio_neon_c_gn/moz.build
index 057bf1e05f30..74c0edfc8065 100644
--- third_party/libwebrtc/common_audio/common_audio_neon_c_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_neon_c_gn/moz.build
@@ -13,12 +13,22 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_ARCH_ARM64"] = True
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_HAS_NEON"] = True
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,148 +57,10 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
-
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
     DEFINES["_DEBUG"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-
 Library("common_audio_neon_c_gn")
diff --git third_party/libwebrtc/common_audio/common_audio_neon_gn/moz.build third_party/libwebrtc/common_audio/common_audio_neon_gn/moz.build
index 4ba3abd64cc9..4a9a332ee3a7 100644
--- third_party/libwebrtc/common_audio/common_audio_neon_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_neon_gn/moz.build
@@ -13,12 +13,22 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_ARCH_ARM64"] = True
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_HAS_NEON"] = True
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,148 +56,10 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
-
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
     DEFINES["_DEBUG"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-
 Library("common_audio_neon_gn")
diff --git third_party/libwebrtc/common_audio/common_audio_sse2_gn/moz.build third_party/libwebrtc/common_audio/common_audio_sse2_gn/moz.build
index 9b0cc3b2530f..a4234c50a2c4 100644
--- third_party/libwebrtc/common_audio/common_audio_sse2_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_sse2_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_AVX2"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,156 +55,23 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    CXXFLAGS += [
-        "-msse2"
-    ]
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    CXXFLAGS += [
-        "-msse2"
-    ]
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
     DEFINES["_DEBUG"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["TARGET_CPU"] == "x86":
 
     CXXFLAGS += [
         "-msse2",
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["TARGET_CPU"] == "x86_64":
 
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    CXXFLAGS += [
-        "-msse2",
-        "-msse2"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    CXXFLAGS += [
-        "-msse2"
-    ]
+    DEFINES["USE_X11"] = "1"
 
 Library("common_audio_sse2_gn")
diff --git third_party/libwebrtc/common_audio/fir_filter_factory_gn/moz.build third_party/libwebrtc/common_audio/fir_filter_factory_gn/moz.build
index 3f6e7760f9ea..d92a68b35e06 100644
--- third_party/libwebrtc/common_audio/fir_filter_factory_gn/moz.build
+++ third_party/libwebrtc/common_audio/fir_filter_factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("fir_filter_factory_gn")
diff --git third_party/libwebrtc/common_audio/fir_filter_gn/moz.build third_party/libwebrtc/common_audio/fir_filter_gn/moz.build
index faa0a79081cd..ae16a06d7d3a 100644
--- third_party/libwebrtc/common_audio/fir_filter_gn/moz.build
+++ third_party/libwebrtc/common_audio/fir_filter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("fir_filter_gn")
diff --git third_party/libwebrtc/common_audio/sinc_resampler_gn/moz.build third_party/libwebrtc/common_audio/sinc_resampler_gn/moz.build
index d9cf6ef8d1e3..cff33184ac39 100644
--- third_party/libwebrtc/common_audio/sinc_resampler_gn/moz.build
+++ third_party/libwebrtc/common_audio/sinc_resampler_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,123 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -166,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("sinc_resampler_gn")
diff --git third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128_gn/moz.build third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128_gn/moz.build
index 5d0978fcf8ce..ba66d5de064e 100644
--- third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128_gn/moz.build
+++ third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,98 +53,7 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
@@ -146,132 +64,42 @@ if CONFIG["TARGET_CPU"] == "aarch64":
         "/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128/ooura_fft_neon.cc"
     ]
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128/ooura_fft_neon.cc"
-    ]
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128/ooura_fft_mips.cc"
     ]
 
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128/ooura_fft_sse2.cc"
-    ]
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128/ooura_fft_sse2.cc"
-    ]
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2",
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    CXXFLAGS += [
-        "-msse2"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin" and CONFIG["TARGET_CPU"] == "x86_64":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
+    UNIFIED_SOURCES += [
+        "/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128/ooura_fft_sse2.cc"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["TARGET_CPU"] == "x86_64":
 
     CXXFLAGS += [
-        "-msse2",
         "-msse2"
     ]
 
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
+    UNIFIED_SOURCES += [
+        "/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128/ooura_fft_sse2.cc"
     ]
 
-    DEFINES["_GNU_SOURCE"] = True
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-if CONFIG["OS_TARGET"] == "OpenBSD" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    CXXFLAGS += [
-        "-msse2"
-    ]
+    DEFINES["USE_X11"] = "1"
 
 Library("fft_size_128_gn")
diff --git third_party/libwebrtc/common_audio/third_party/ooura/fft_size_256_gn/moz.build third_party/libwebrtc/common_audio/third_party/ooura/fft_size_256_gn/moz.build
index abbf58c8e6e1..c8156058abd1 100644
--- third_party/libwebrtc/common_audio/third_party/ooura/fft_size_256_gn/moz.build
+++ third_party/libwebrtc/common_audio/third_party/ooura/fft_size_256_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("fft_size_256_gn")
diff --git third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_gn/moz.build third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_gn/moz.build
index e0887017963d..84d5c6e4a8cb 100644
--- third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_gn/moz.build
+++ third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,115 +49,19 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
-    ]
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-    SOURCES += [
-        "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_arm.S"
+    UNIFIED_SOURCES += [
+        "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
     ]
 
 if CONFIG["TARGET_CPU"] == "loongarch64":
 
-    DEFINES["_GNU_SOURCE"] = True
-
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
     ]
@@ -157,7 +70,6 @@ if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_mips.c"
@@ -165,8 +77,6 @@ if CONFIG["TARGET_CPU"] == "mips32":
 
 if CONFIG["TARGET_CPU"] == "mips64":
 
-    DEFINES["_GNU_SOURCE"] = True
-
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
     ]
@@ -177,102 +87,34 @@ if CONFIG["TARGET_CPU"] == "ppc64":
         "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
     ]
 
-if CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "aarch64":
+if CONFIG["TARGET_CPU"] == "riscv64":
 
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
     ]
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["TARGET_CPU"] == "x86":
 
     CFLAGS += [
         "-msse2"
     ]
 
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "riscv64":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    CFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
     UNIFIED_SOURCES += [
         "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
-    ]
+    DEFINES["USE_X11"] = "1"
 
 Library("spl_sqrt_floor_gn")
diff --git third_party/libwebrtc/common_video/common_video_gn/moz.build third_party/libwebrtc/common_video/common_video_gn/moz.build
index 85b1d6e3876a..b94189d3545a 100644
--- third_party/libwebrtc/common_video/common_video_gn/moz.build
+++ third_party/libwebrtc/common_video/common_video_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -56,186 +65,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("common_video_gn")
diff --git third_party/libwebrtc/common_video/corruption_detection_converters_gn/moz.build third_party/libwebrtc/common_video/corruption_detection_converters_gn/moz.build
index 9944edddcfc7..dab4c0cf2af3 100644
--- third_party/libwebrtc/common_video/corruption_detection_converters_gn/moz.build
+++ third_party/libwebrtc/common_video/corruption_detection_converters_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("corruption_detection_converters_gn")
diff --git third_party/libwebrtc/common_video/corruption_score_calculator_gn/moz.build third_party/libwebrtc/common_video/corruption_score_calculator_gn/moz.build
index fca1c9f668b8..96e6cd2de3f4 100644
--- third_party/libwebrtc/common_video/corruption_score_calculator_gn/moz.build
+++ third_party/libwebrtc/common_video/corruption_score_calculator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("corruption_score_calculator_gn")
diff --git third_party/libwebrtc/common_video/frame_counts_gn/moz.build third_party/libwebrtc/common_video/frame_counts_gn/moz.build
index 79118636ef57..a240d297e534 100644
--- third_party/libwebrtc/common_video/frame_counts_gn/moz.build
+++ third_party/libwebrtc/common_video/frame_counts_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("frame_counts_gn")
diff --git third_party/libwebrtc/common_video/frame_instrumentation_data_gn/moz.build third_party/libwebrtc/common_video/frame_instrumentation_data_gn/moz.build
index ad826406041d..9a33fa9b8af1 100644
--- third_party/libwebrtc/common_video/frame_instrumentation_data_gn/moz.build
+++ third_party/libwebrtc/common_video/frame_instrumentation_data_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("frame_instrumentation_data_gn")
diff --git third_party/libwebrtc/common_video/generic_frame_descriptor/generic_frame_descriptor_gn/moz.build third_party/libwebrtc/common_video/generic_frame_descriptor/generic_frame_descriptor_gn/moz.build
index 41c302c40bdf..faf1b8af307c 100644
--- third_party/libwebrtc/common_video/generic_frame_descriptor/generic_frame_descriptor_gn/moz.build
+++ third_party/libwebrtc/common_video/generic_frame_descriptor/generic_frame_descriptor_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("generic_frame_descriptor_gn")
diff --git third_party/libwebrtc/dcsctp_gn/moz.build third_party/libwebrtc/dcsctp_gn/moz.build
index d257f1ad2fa8..b3b3098adf87 100644
--- third_party/libwebrtc/dcsctp_gn/moz.build
+++ third_party/libwebrtc/dcsctp_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("dcsctp_gn")
diff --git third_party/libwebrtc/experiments/registered_field_trials_gn/moz.build third_party/libwebrtc/experiments/registered_field_trials_gn/moz.build
index d145d0ea9376..c46ee2a6426e 100644
--- third_party/libwebrtc/experiments/registered_field_trials_gn/moz.build
+++ third_party/libwebrtc/experiments/registered_field_trials_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("registered_field_trials_gn")
diff --git third_party/libwebrtc/experiments/registered_field_trials_header_gn/moz.build third_party/libwebrtc/experiments/registered_field_trials_header_gn/moz.build
index 6c29dea76a50..3ae54a950c46 100644
--- third_party/libwebrtc/experiments/registered_field_trials_header_gn/moz.build
+++ third_party/libwebrtc/experiments/registered_field_trials_header_gn/moz.build
@@ -31,9 +31,4 @@ LOCAL_INCLUDES += [
     "/tools/profiler/public"
 ]
 
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["UNICODE"] = True
-    DEFINES["_UNICODE"] = True
-
 Library("registered_field_trials_header_gn")
diff --git third_party/libwebrtc/logging/rtc_event_audio_gn/moz.build third_party/libwebrtc/logging/rtc_event_audio_gn/moz.build
index 87c1d54c4df1..1de0302ecc91 100644
--- third_party/libwebrtc/logging/rtc_event_audio_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_audio_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -48,186 +57,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_event_audio_gn")
diff --git third_party/libwebrtc/logging/rtc_event_bwe_gn/moz.build third_party/libwebrtc/logging/rtc_event_bwe_gn/moz.build
index 7abe0e6ab8f6..c00986cd7d3f 100644
--- third_party/libwebrtc/logging/rtc_event_bwe_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_bwe_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -49,186 +58,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_event_bwe_gn")
diff --git third_party/libwebrtc/logging/rtc_event_field_gn/moz.build third_party/libwebrtc/logging/rtc_event_field_gn/moz.build
index 173a4af52ed4..f49361ea7deb 100644
--- third_party/libwebrtc/logging/rtc_event_field_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_field_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,186 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_event_field_gn")
diff --git third_party/libwebrtc/logging/rtc_event_log_parse_status_gn/moz.build third_party/libwebrtc/logging/rtc_event_log_parse_status_gn/moz.build
index 988db900c124..58ac771f6db7 100644
--- third_party/libwebrtc/logging/rtc_event_log_parse_status_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_log_parse_status_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rtc_event_log_parse_status_gn")
diff --git third_party/libwebrtc/logging/rtc_event_number_encodings_gn/moz.build third_party/libwebrtc/logging/rtc_event_number_encodings_gn/moz.build
index eb57df474228..3feab91a7084 100644
--- third_party/libwebrtc/logging/rtc_event_number_encodings_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_number_encodings_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,179 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_event_number_encodings_gn")
diff --git third_party/libwebrtc/logging/rtc_event_pacing_gn/moz.build third_party/libwebrtc/logging/rtc_event_pacing_gn/moz.build
index 46192e21f4e7..c9d38230adf6 100644
--- third_party/libwebrtc/logging/rtc_event_pacing_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_pacing_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_event_pacing_gn")
diff --git third_party/libwebrtc/logging/rtc_event_rtp_rtcp_gn/moz.build third_party/libwebrtc/logging/rtc_event_rtp_rtcp_gn/moz.build
index db532092f5ba..973cc40e2eb7 100644
--- third_party/libwebrtc/logging/rtc_event_rtp_rtcp_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_rtp_rtcp_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,190 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_event_rtp_rtcp_gn")
diff --git third_party/libwebrtc/logging/rtc_event_video_gn/moz.build third_party/libwebrtc/logging/rtc_event_video_gn/moz.build
index 880219f21c25..bc58f4335961 100644
--- third_party/libwebrtc/logging/rtc_event_video_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_video_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,186 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_event_video_gn")
diff --git third_party/libwebrtc/logging/rtc_stream_config_gn/moz.build third_party/libwebrtc/logging/rtc_stream_config_gn/moz.build
index 71ec6e58eab4..98496cf6ad3d 100644
--- third_party/libwebrtc/logging/rtc_stream_config_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_stream_config_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_stream_config_gn")
diff --git third_party/libwebrtc/media/adapted_video_track_source_gn/moz.build third_party/libwebrtc/media/adapted_video_track_source_gn/moz.build
index fc9a05fecbd7..f730e651788a 100644
--- third_party/libwebrtc/media/adapted_video_track_source_gn/moz.build
+++ third_party/libwebrtc/media/adapted_video_track_source_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("adapted_video_track_source_gn")
diff --git third_party/libwebrtc/media/audio_source_gn/moz.build third_party/libwebrtc/media/audio_source_gn/moz.build
index b3ffa731b047..556c37a94cdd 100644
--- third_party/libwebrtc/media/audio_source_gn/moz.build
+++ third_party/libwebrtc/media/audio_source_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("audio_source_gn")
diff --git third_party/libwebrtc/media/codec_gn/moz.build third_party/libwebrtc/media/codec_gn/moz.build
index fa1c367755e9..073728d67c50 100644
--- third_party/libwebrtc/media/codec_gn/moz.build
+++ third_party/libwebrtc/media/codec_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,186 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("codec_gn")
diff --git third_party/libwebrtc/media/media_channel_gn/moz.build third_party/libwebrtc/media/media_channel_gn/moz.build
index 50c9885138f8..16e5ba4ee32e 100644
--- third_party/libwebrtc/media/media_channel_gn/moz.build
+++ third_party/libwebrtc/media/media_channel_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,124 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -167,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("media_channel_gn")
diff --git third_party/libwebrtc/media/media_channel_impl_gn/moz.build third_party/libwebrtc/media/media_channel_impl_gn/moz.build
index 5e6822d5bdc0..400eab1bee62 100644
--- third_party/libwebrtc/media/media_channel_impl_gn/moz.build
+++ third_party/libwebrtc/media/media_channel_impl_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("media_channel_impl_gn")
diff --git third_party/libwebrtc/media/media_constants_gn/moz.build third_party/libwebrtc/media/media_constants_gn/moz.build
index 38e1075093fa..1dda12f2a71d 100644
--- third_party/libwebrtc/media/media_constants_gn/moz.build
+++ third_party/libwebrtc/media/media_constants_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("media_constants_gn")
diff --git third_party/libwebrtc/media/media_engine_gn/moz.build third_party/libwebrtc/media/media_engine_gn/moz.build
index 20c2853bfc82..696f3b2819c5 100644
--- third_party/libwebrtc/media/media_engine_gn/moz.build
+++ third_party/libwebrtc/media/media_engine_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,124 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -167,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("media_engine_gn")
diff --git third_party/libwebrtc/media/rid_description_gn/moz.build third_party/libwebrtc/media/rid_description_gn/moz.build
index 92aa0430434d..6fae71d28c23 100644
--- third_party/libwebrtc/media/rid_description_gn/moz.build
+++ third_party/libwebrtc/media/rid_description_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rid_description_gn")
diff --git third_party/libwebrtc/media/rtc_audio_video_gn/moz.build third_party/libwebrtc/media/rtc_audio_video_gn/moz.build
index 6a4544f54efa..8d0d58c29bd7 100644
--- third_party/libwebrtc/media/rtc_audio_video_gn/moz.build
+++ third_party/libwebrtc/media/rtc_audio_video_gn/moz.build
@@ -14,11 +14,20 @@ DEFINES["HAVE_WEBRTC_VIDEO"] = True
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,195 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "ole32",
-        "oleaut32",
-        "secur32",
-        "strmiids",
-        "user32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_audio_video_gn")
diff --git third_party/libwebrtc/media/rtc_internal_video_codecs_gn/moz.build third_party/libwebrtc/media/rtc_internal_video_codecs_gn/moz.build
index e80128aecdeb..77526b138660 100644
--- third_party/libwebrtc/media/rtc_internal_video_codecs_gn/moz.build
+++ third_party/libwebrtc/media/rtc_internal_video_codecs_gn/moz.build
@@ -14,11 +14,20 @@ DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
 DEFINES["RTC_USE_LIBAOM_AV1_ENCODER"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,191 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_internal_video_codecs_gn")
diff --git third_party/libwebrtc/media/rtc_media_base_gn/moz.build third_party/libwebrtc/media/rtc_media_base_gn/moz.build
index 58c4f572fa11..7e7ca1cbab42 100644
--- third_party/libwebrtc/media/rtc_media_base_gn/moz.build
+++ third_party/libwebrtc/media/rtc_media_base_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,124 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -167,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rtc_media_base_gn")
diff --git third_party/libwebrtc/media/rtc_media_config_gn/moz.build third_party/libwebrtc/media/rtc_media_config_gn/moz.build
index 42d0c4a66949..c50b94a79309 100644
--- third_party/libwebrtc/media/rtc_media_config_gn/moz.build
+++ third_party/libwebrtc/media/rtc_media_config_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rtc_media_config_gn")
diff --git third_party/libwebrtc/media/rtc_media_gn/moz.build third_party/libwebrtc/media/rtc_media_gn/moz.build
index 090c3083a914..f84a9e395510 100644
--- third_party/libwebrtc/media/rtc_media_gn/moz.build
+++ third_party/libwebrtc/media/rtc_media_gn/moz.build
@@ -14,11 +14,20 @@ DEFINES["HAVE_WEBRTC_VIDEO"] = True
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -41,128 +50,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "ole32",
-        "oleaut32",
-        "secur32",
-        "strmiids",
-        "user32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -172,50 +70,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rtc_media_gn")
diff --git third_party/libwebrtc/media/rtc_sdp_video_format_utils_gn/moz.build third_party/libwebrtc/media/rtc_sdp_video_format_utils_gn/moz.build
index 0b90567eff54..581f825bfb68 100644
--- third_party/libwebrtc/media/rtc_sdp_video_format_utils_gn/moz.build
+++ third_party/libwebrtc/media/rtc_sdp_video_format_utils_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_sdp_video_format_utils_gn")
diff --git third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build
index cb9bed23cb55..fe76cd431ff6 100644
--- third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build
+++ third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_simulcast_encoder_adapter_gn")
diff --git third_party/libwebrtc/media/rtp_utils_gn/moz.build third_party/libwebrtc/media/rtp_utils_gn/moz.build
index 27f94a49fa4b..8d2edadb7d0e 100644
--- third_party/libwebrtc/media/rtp_utils_gn/moz.build
+++ third_party/libwebrtc/media/rtp_utils_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rtp_utils_gn")
diff --git third_party/libwebrtc/media/stream_params_gn/moz.build third_party/libwebrtc/media/stream_params_gn/moz.build
index c65d7a53ed46..ef3886295fed 100644
--- third_party/libwebrtc/media/stream_params_gn/moz.build
+++ third_party/libwebrtc/media/stream_params_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("stream_params_gn")
diff --git third_party/libwebrtc/media/video_adapter_gn/moz.build third_party/libwebrtc/media/video_adapter_gn/moz.build
index d06fd4ea8e37..4e50253cb413 100644
--- third_party/libwebrtc/media/video_adapter_gn/moz.build
+++ third_party/libwebrtc/media/video_adapter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_adapter_gn")
diff --git third_party/libwebrtc/media/video_broadcaster_gn/moz.build third_party/libwebrtc/media/video_broadcaster_gn/moz.build
index 3d33f289d9a2..52b7067da392 100644
--- third_party/libwebrtc/media/video_broadcaster_gn/moz.build
+++ third_party/libwebrtc/media/video_broadcaster_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_broadcaster_gn")
diff --git third_party/libwebrtc/media/video_common_gn/moz.build third_party/libwebrtc/media/video_common_gn/moz.build
index 3423c19bd60e..03bd0dd5e648 100644
--- third_party/libwebrtc/media/video_common_gn/moz.build
+++ third_party/libwebrtc/media/video_common_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_common_gn")
diff --git third_party/libwebrtc/media/video_source_base_gn/moz.build third_party/libwebrtc/media/video_source_base_gn/moz.build
index 8bfea357cdbb..2f9861d6c38a 100644
--- third_party/libwebrtc/media/video_source_base_gn/moz.build
+++ third_party/libwebrtc/media/video_source_base_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_source_base_gn")
diff --git third_party/libwebrtc/modules/async_audio_processing/async_audio_processing_gn/moz.build third_party/libwebrtc/modules/async_audio_processing/async_audio_processing_gn/moz.build
index df4aa2f2cf44..03f4a4610a90 100644
--- third_party/libwebrtc/modules/async_audio_processing/async_audio_processing_gn/moz.build
+++ third_party/libwebrtc/modules/async_audio_processing/async_audio_processing_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("async_audio_processing_gn")
diff --git third_party/libwebrtc/modules/audio_coding/audio_coding_gn/moz.build third_party/libwebrtc/modules/audio_coding/audio_coding_gn/moz.build
index 7ced6b2f5e9a..0dcf2ab3da45 100644
--- third_party/libwebrtc/modules/audio_coding/audio_coding_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/audio_coding_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,190 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_coding_gn")
diff --git third_party/libwebrtc/modules/audio_coding/audio_coding_module_typedefs_gn/moz.build third_party/libwebrtc/modules/audio_coding/audio_coding_module_typedefs_gn/moz.build
index ba94b42663e7..18b923fd01d7 100644
--- third_party/libwebrtc/modules/audio_coding/audio_coding_module_typedefs_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/audio_coding_module_typedefs_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("audio_coding_module_typedefs_gn")
diff --git third_party/libwebrtc/modules/audio_coding/audio_coding_opus_common_gn/moz.build third_party/libwebrtc/modules/audio_coding/audio_coding_opus_common_gn/moz.build
index 30e0511c1202..60a140cf508e 100644
--- third_party/libwebrtc/modules/audio_coding/audio_coding_opus_common_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/audio_coding_opus_common_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_coding_opus_common_gn")
diff --git third_party/libwebrtc/modules/audio_coding/audio_encoder_cng_gn/moz.build third_party/libwebrtc/modules/audio_coding/audio_encoder_cng_gn/moz.build
index 517f1c385402..a90873f05e5f 100644
--- third_party/libwebrtc/modules/audio_coding/audio_encoder_cng_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/audio_encoder_cng_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_encoder_cng_gn")
diff --git third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_config_gn/moz.build third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_config_gn/moz.build
index 0551767ad41e..d59a3765cd70 100644
--- third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_config_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_config_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_network_adaptor_config_gn")
diff --git third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_gn/moz.build third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_gn/moz.build
index e67a684aaf53..7919faa59988 100644
--- third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -54,190 +63,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_network_adaptor_gn")
diff --git third_party/libwebrtc/modules/audio_coding/g711_c_gn/moz.build third_party/libwebrtc/modules/audio_coding/g711_c_gn/moz.build
index dedcda5d379f..7381cf2820f4 100644
--- third_party/libwebrtc/modules/audio_coding/g711_c_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/g711_c_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("g711_c_gn")
diff --git third_party/libwebrtc/modules/audio_coding/g711_gn/moz.build third_party/libwebrtc/modules/audio_coding/g711_gn/moz.build
index 6ff2b5757c16..46fe5e5d3952 100644
--- third_party/libwebrtc/modules/audio_coding/g711_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/g711_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,186 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("g711_gn")
diff --git third_party/libwebrtc/modules/audio_coding/g722_c_gn/moz.build third_party/libwebrtc/modules/audio_coding/g722_c_gn/moz.build
index 7af4da2823b9..08ab446a0a88 100644
--- third_party/libwebrtc/modules/audio_coding/g722_c_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/g722_c_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("g722_c_gn")
diff --git third_party/libwebrtc/modules/audio_coding/g722_gn/moz.build third_party/libwebrtc/modules/audio_coding/g722_gn/moz.build
index 5a440b4ff1c8..2fdbaa878fc1 100644
--- third_party/libwebrtc/modules/audio_coding/g722_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/g722_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,186 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("g722_gn")
diff --git third_party/libwebrtc/modules/audio_coding/isac_bwinfo_gn/moz.build third_party/libwebrtc/modules/audio_coding/isac_bwinfo_gn/moz.build
index 8337bf3634c6..ac6b63091c79 100644
--- third_party/libwebrtc/modules/audio_coding/isac_bwinfo_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/isac_bwinfo_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("isac_bwinfo_gn")
diff --git third_party/libwebrtc/modules/audio_coding/isac_vad_gn/moz.build third_party/libwebrtc/modules/audio_coding/isac_vad_gn/moz.build
index ea88c1d8f583..57e8546bdbf4 100644
--- third_party/libwebrtc/modules/audio_coding/isac_vad_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/isac_vad_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,175 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("isac_vad_gn")
diff --git third_party/libwebrtc/modules/audio_coding/legacy_encoded_audio_frame_gn/moz.build third_party/libwebrtc/modules/audio_coding/legacy_encoded_audio_frame_gn/moz.build
index ca334dc3fe78..747b4ac34f8c 100644
--- third_party/libwebrtc/modules/audio_coding/legacy_encoded_audio_frame_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/legacy_encoded_audio_frame_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("legacy_encoded_audio_frame_gn")
diff --git third_party/libwebrtc/modules/audio_coding/neteq_gn/moz.build third_party/libwebrtc/modules/audio_coding/neteq_gn/moz.build
index 2551d1916e01..87a4113e6abf 100644
--- third_party/libwebrtc/modules/audio_coding/neteq_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/neteq_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -79,190 +88,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("neteq_gn")
diff --git third_party/libwebrtc/modules/audio_coding/pcm16b_c_gn/moz.build third_party/libwebrtc/modules/audio_coding/pcm16b_c_gn/moz.build
index d9334cabeb19..030e4a70ff28 100644
--- third_party/libwebrtc/modules/audio_coding/pcm16b_c_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/pcm16b_c_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("pcm16b_c_gn")
diff --git third_party/libwebrtc/modules/audio_coding/pcm16b_gn/moz.build third_party/libwebrtc/modules/audio_coding/pcm16b_gn/moz.build
index 0b30779563f7..c552b27c5ff3 100644
--- third_party/libwebrtc/modules/audio_coding/pcm16b_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/pcm16b_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,186 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("pcm16b_gn")
diff --git third_party/libwebrtc/modules/audio_coding/red_gn/moz.build third_party/libwebrtc/modules/audio_coding/red_gn/moz.build
index 58e8afef9a00..965e9dd8ba94 100644
--- third_party/libwebrtc/modules/audio_coding/red_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/red_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("red_gn")
diff --git third_party/libwebrtc/modules/audio_coding/webrtc_cng_gn/moz.build third_party/libwebrtc/modules/audio_coding/webrtc_cng_gn/moz.build
index 291bd3be385d..1deff194ac14 100644
--- third_party/libwebrtc/modules/audio_coding/webrtc_cng_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/webrtc_cng_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("webrtc_cng_gn")
diff --git third_party/libwebrtc/modules/audio_coding/webrtc_multiopus_gn/moz.build third_party/libwebrtc/modules/audio_coding/webrtc_multiopus_gn/moz.build
index 6dfe8fd91f4f..104ad0dd9d28 100644
--- third_party/libwebrtc/modules/audio_coding/webrtc_multiopus_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/webrtc_multiopus_gn/moz.build
@@ -13,13 +13,22 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_CODEC_OPUS"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
 DEFINES["WEBRTC_OPUS_SUPPORT_120MS_PTIME"] = "1"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -48,186 +57,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("webrtc_multiopus_gn")
diff --git third_party/libwebrtc/modules/audio_coding/webrtc_opus_gn/moz.build third_party/libwebrtc/modules/audio_coding/webrtc_opus_gn/moz.build
index 867fbd623276..2094705f8b93 100644
--- third_party/libwebrtc/modules/audio_coding/webrtc_opus_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/webrtc_opus_gn/moz.build
@@ -13,13 +13,22 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_CODEC_OPUS"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
 DEFINES["WEBRTC_OPUS_SUPPORT_120MS_PTIME"] = "1"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -48,190 +57,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("webrtc_opus_gn")
diff --git third_party/libwebrtc/modules/audio_coding/webrtc_opus_wrapper_gn/moz.build third_party/libwebrtc/modules/audio_coding/webrtc_opus_wrapper_gn/moz.build
index 5ec9b465ea77..162b9091b2d2 100644
--- third_party/libwebrtc/modules/audio_coding/webrtc_opus_wrapper_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/webrtc_opus_wrapper_gn/moz.build
@@ -13,13 +13,22 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_CODEC_OPUS"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
 DEFINES["WEBRTC_OPUS_SUPPORT_120MS_PTIME"] = "1"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,179 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("webrtc_opus_wrapper_gn")
diff --git third_party/libwebrtc/modules/audio_device/audio_device_gn/moz.build third_party/libwebrtc/modules/audio_device/audio_device_gn/moz.build
index 4ca6aa495569..3885140cb11b 100644
--- third_party/libwebrtc/modules/audio_device/audio_device_gn/moz.build
+++ third_party/libwebrtc/modules/audio_device/audio_device_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("audio_device_gn")
diff --git third_party/libwebrtc/modules/audio_device/audio_device_impl_gn/moz.build third_party/libwebrtc/modules/audio_device/audio_device_impl_gn/moz.build
index 65a33184e738..4a54e312b60b 100644
--- third_party/libwebrtc/modules/audio_device/audio_device_impl_gn/moz.build
+++ third_party/libwebrtc/modules/audio_device/audio_device_impl_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("audio_device_impl_gn")
diff --git third_party/libwebrtc/modules/audio_mixer/audio_frame_manipulator_gn/moz.build third_party/libwebrtc/modules/audio_mixer/audio_frame_manipulator_gn/moz.build
index a14b9eb8fe9a..8fd614a1e9e9 100644
--- third_party/libwebrtc/modules/audio_mixer/audio_frame_manipulator_gn/moz.build
+++ third_party/libwebrtc/modules/audio_mixer/audio_frame_manipulator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_frame_manipulator_gn")
diff --git third_party/libwebrtc/modules/audio_mixer/audio_mixer_impl_gn/moz.build third_party/libwebrtc/modules/audio_mixer/audio_mixer_impl_gn/moz.build
index 079f132d8ed0..9e2e510689f2 100644
--- third_party/libwebrtc/modules/audio_mixer/audio_mixer_impl_gn/moz.build
+++ third_party/libwebrtc/modules/audio_mixer/audio_mixer_impl_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,190 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_mixer_impl_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl_gn/moz.build
index 7ad364fc287b..6392e9de1af6 100644
--- third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("adaptive_fir_filter_erl_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_gn/moz.build
index c3c6602eeabe..668753ceeacd 100644
--- third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,123 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -166,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("adaptive_fir_filter_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn/moz.build
index 2a389ece3b18..50070028546d 100644
--- third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn/moz.build
@@ -18,13 +18,22 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_AVX2"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -55,134 +64,16 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
     DEFINES["_DEBUG"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["TARGET_CPU"] == "x86":
 
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+    DEFINES["USE_X11"] = "1"
 
 Library("aec3_avx2_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec3/aec3_common_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec3/aec3_common_gn/moz.build
index 03c744941770..e5ed79803265 100644
--- third_party/libwebrtc/modules/audio_processing/aec3/aec3_common_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec3/aec3_common_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("aec3_common_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec3/aec3_fft_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec3/aec3_fft_gn/moz.build
index b840e8d28285..dabb2ba6b331 100644
--- third_party/libwebrtc/modules/audio_processing/aec3/aec3_fft_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec3/aec3_fft_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,123 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -166,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("aec3_fft_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec3/aec3_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec3/aec3_gn/moz.build
index bb4aa00b9fa6..3b77e799840a 100644
--- third_party/libwebrtc/modules/audio_processing/aec3/aec3_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec3/aec3_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -101,190 +110,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("aec3_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec3/fft_data_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec3/fft_data_gn/moz.build
index d91b97726db0..af84b43ca439 100644
--- third_party/libwebrtc/modules/audio_processing/aec3/fft_data_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec3/fft_data_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("fft_data_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec3/matched_filter_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec3/matched_filter_gn/moz.build
index f423946bc227..c3324812d865 100644
--- third_party/libwebrtc/modules/audio_processing/aec3/matched_filter_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec3/matched_filter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("matched_filter_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec3/render_buffer_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec3/render_buffer_gn/moz.build
index 45a89ccbfbfa..fe641efc8111 100644
--- third_party/libwebrtc/modules/audio_processing/aec3/render_buffer_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec3/render_buffer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("render_buffer_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec3/vector_math_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec3/vector_math_gn/moz.build
index 2c6400d8b230..f9c9407c1a18 100644
--- third_party/libwebrtc/modules/audio_processing/aec3/vector_math_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec3/vector_math_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("vector_math_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_gn/moz.build
index 644c5fb92216..892353d5a5a9 100644
--- third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("aec_dump_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec_dump/null_aec_dump_factory_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec_dump/null_aec_dump_factory_gn/moz.build
index e3ddd42e6d91..22365c268eb4 100644
--- third_party/libwebrtc/modules/audio_processing/aec_dump/null_aec_dump_factory_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec_dump/null_aec_dump_factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("null_aec_dump_factory_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aec_dump_interface_gn/moz.build third_party/libwebrtc/modules/audio_processing/aec_dump_interface_gn/moz.build
index 55fe444f90d4..b518e0fe73db 100644
--- third_party/libwebrtc/modules/audio_processing/aec_dump_interface_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec_dump_interface_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("aec_dump_interface_gn")
diff --git third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_gn/moz.build third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_gn/moz.build
index fc9828874560..d280cf9642f4 100644
--- third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,114 +54,7 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-    SOURCES += [
-        "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    SOURCES += [
-        "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    SOURCES += [
-        "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
-
-    SOURCES += [
-        "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
@@ -160,27 +62,12 @@ if CONFIG["TARGET_CPU"] == "aarch64":
     DEFINES["WEBRTC_HAS_NEON"] = True
 
     SOURCES += [
-        "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_neon.cc"
-    ]
-
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-    SOURCES += [
+        "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc",
         "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_neon.cc"
     ]
 
 if CONFIG["TARGET_CPU"] == "loongarch64":
 
-    DEFINES["_GNU_SOURCE"] = True
-
     SOURCES += [
         "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc"
     ]
@@ -189,7 +76,6 @@ if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     SOURCES += [
         "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_mips.cc"
@@ -197,8 +83,6 @@ if CONFIG["TARGET_CPU"] == "mips32":
 
 if CONFIG["TARGET_CPU"] == "mips64":
 
-    DEFINES["_GNU_SOURCE"] = True
-
     SOURCES += [
         "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc"
     ]
@@ -209,90 +93,34 @@ if CONFIG["TARGET_CPU"] == "ppc64":
         "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc"
     ]
 
-if CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
-    CXXFLAGS += [
-        "-msse2"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-    SOURCES += [
-        "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
+if CONFIG["TARGET_CPU"] == "riscv64":
 
     SOURCES += [
         "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "riscv64":
-
-    SOURCES += [
-        "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["TARGET_CPU"] == "x86":
 
     CXXFLAGS += [
         "-msse2"
     ]
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
     SOURCES += [
         "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
     SOURCES += [
         "/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_c.cc"
     ]
 
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
+
+    DEFINES["USE_X11"] = "1"
+
 Library("aecm_core_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc/agc_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc/agc_gn/moz.build
index c4325ac824cb..47f526008661 100644
--- third_party/libwebrtc/modules/audio_processing/agc/agc_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc/agc_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("agc_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc/gain_control_interface_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc/gain_control_interface_gn/moz.build
index 5983e4f77576..127f60740aed 100644
--- third_party/libwebrtc/modules/audio_processing/agc/gain_control_interface_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc/gain_control_interface_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("gain_control_interface_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc/legacy_agc_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc/legacy_agc_gn/moz.build
index fc5a6d3a17ac..13a466730810 100644
--- third_party/libwebrtc/modules/audio_processing/agc/legacy_agc_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc/legacy_agc_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("legacy_agc_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc/level_estimation_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc/level_estimation_gn/moz.build
index 35537a26bfaa..9f58d8bde235 100644
--- third_party/libwebrtc/modules/audio_processing/agc/level_estimation_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc/level_estimation_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,190 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("level_estimation_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/adaptive_digital_gain_controller_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/adaptive_digital_gain_controller_gn/moz.build
index e225f10fa3cd..d7a4d53ab75c 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/adaptive_digital_gain_controller_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/adaptive_digital_gain_controller_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("adaptive_digital_gain_controller_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/biquad_filter_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/biquad_filter_gn/moz.build
index 6622d617c907..8dfe3f760d23 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/biquad_filter_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/biquad_filter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("biquad_filter_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/clipping_predictor_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/clipping_predictor_gn/moz.build
index beda030559b6..bb6b4b02c9bb 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/clipping_predictor_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/clipping_predictor_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("clipping_predictor_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/common_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/common_gn/moz.build
index cf2c69fcdfaa..a3693736aedb 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/common_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/common_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("common_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/cpu_features_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/cpu_features_gn/moz.build
index 0de2dc9384e3..de0334f13255 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/cpu_features_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/cpu_features_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("cpu_features_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/fixed_digital_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/fixed_digital_gn/moz.build
index 42be77d0926e..5cc90ad1f104 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/fixed_digital_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/fixed_digital_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,190 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("fixed_digital_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/gain_applier_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/gain_applier_gn/moz.build
index 74f97ce3d86b..e5ccbba3faa4 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/gain_applier_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/gain_applier_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("gain_applier_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/gain_map_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/gain_map_gn/moz.build
index f737fa6929fb..27094cde280b 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/gain_map_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/gain_map_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("gain_map_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/input_volume_controller_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/input_volume_controller_gn/moz.build
index e9a5eecf6501..f974969cef4f 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/input_volume_controller_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/input_volume_controller_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,190 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("input_volume_controller_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/input_volume_stats_reporter_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/input_volume_stats_reporter_gn/moz.build
index 16dc6a71efd0..e9e41bc13fdb 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/input_volume_stats_reporter_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/input_volume_stats_reporter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("input_volume_stats_reporter_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/noise_level_estimator_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/noise_level_estimator_gn/moz.build
index 9c436a5d0f3a..7af9460687a6 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/noise_level_estimator_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/noise_level_estimator_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("noise_level_estimator_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_auto_correlation_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_auto_correlation_gn/moz.build
index 59564cc1e285..954c989398f4 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_auto_correlation_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_auto_correlation_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rnn_vad_auto_correlation_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_common_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_common_gn/moz.build
index bf0b365e6eee..52089937e2a4 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_common_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_common_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,123 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -166,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rnn_vad_common_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_gn/moz.build
index 138685a386db..575ac8951bd6 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rnn_vad_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_layers_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_layers_gn/moz.build
index 699bc21ae364..577a86ada3c3 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_layers_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_layers_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rnn_vad_layers_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_lp_residual_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_lp_residual_gn/moz.build
index b25ad71cb8d9..0e7ee8647c24 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_lp_residual_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_lp_residual_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rnn_vad_lp_residual_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_pitch_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_pitch_gn/moz.build
index 236281787c93..537751526475 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_pitch_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_pitch_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rnn_vad_pitch_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_ring_buffer_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_ring_buffer_gn/moz.build
index 49e0ac0e1752..af5b80e27004 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_ring_buffer_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_ring_buffer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rnn_vad_ring_buffer_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_sequence_buffer_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_sequence_buffer_gn/moz.build
index 25ebe1ded808..5aeecbb95fb0 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_sequence_buffer_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_sequence_buffer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rnn_vad_sequence_buffer_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_spectral_features_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_spectral_features_gn/moz.build
index 3fd01cae8e39..6029a14a410a 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_spectral_features_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_spectral_features_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rnn_vad_spectral_features_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_symmetric_matrix_buffer_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_symmetric_matrix_buffer_gn/moz.build
index 81600c1ed958..654468ece4cd 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_symmetric_matrix_buffer_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_symmetric_matrix_buffer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rnn_vad_symmetric_matrix_buffer_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_avx2_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_avx2_gn/moz.build
index c27d2ed5f439..286a59787858 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_avx2_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_avx2_gn/moz.build
@@ -18,12 +18,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_AVX2"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -50,134 +59,16 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
     DEFINES["_DEBUG"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["TARGET_CPU"] == "x86":
 
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+    DEFINES["USE_X11"] = "1"
 
 Library("vector_math_avx2_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_gn/moz.build
index 9b4370335783..f9c9407c1a18 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,123 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -166,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("vector_math_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/saturation_protector_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/saturation_protector_gn/moz.build
index c312fba12052..d996b4cc9d90 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/saturation_protector_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/saturation_protector_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,190 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("saturation_protector_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/speech_level_estimator_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/speech_level_estimator_gn/moz.build
index 343cfc723b09..8c6eb49b4512 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/speech_level_estimator_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/speech_level_estimator_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("speech_level_estimator_gn")
diff --git third_party/libwebrtc/modules/audio_processing/agc2/vad_wrapper_gn/moz.build third_party/libwebrtc/modules/audio_processing/agc2/vad_wrapper_gn/moz.build
index a82ded938c6b..93c53adca4bb 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/vad_wrapper_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/vad_wrapper_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("vad_wrapper_gn")
diff --git third_party/libwebrtc/modules/audio_processing/apm_logging_gn/moz.build third_party/libwebrtc/modules/audio_processing/apm_logging_gn/moz.build
index a09b4c70b19d..23f44e13d5bb 100644
--- third_party/libwebrtc/modules/audio_processing/apm_logging_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/apm_logging_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("apm_logging_gn")
diff --git third_party/libwebrtc/modules/audio_processing/audio_buffer_gn/moz.build third_party/libwebrtc/modules/audio_processing/audio_buffer_gn/moz.build
index 2b2e58b89940..b833396bba9b 100644
--- third_party/libwebrtc/modules/audio_processing/audio_buffer_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/audio_buffer_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,190 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_buffer_gn")
diff --git third_party/libwebrtc/modules/audio_processing/audio_frame_proxies_gn/moz.build third_party/libwebrtc/modules/audio_processing/audio_frame_proxies_gn/moz.build
index 062f65365d8d..c6e89fcf1c87 100644
--- third_party/libwebrtc/modules/audio_processing/audio_frame_proxies_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/audio_frame_proxies_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_frame_proxies_gn")
diff --git third_party/libwebrtc/modules/audio_processing/audio_frame_view_gn/moz.build third_party/libwebrtc/modules/audio_processing/audio_frame_view_gn/moz.build
index 66e92461dade..cca630b76705 100644
--- third_party/libwebrtc/modules/audio_processing/audio_frame_view_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/audio_frame_view_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("audio_frame_view_gn")
diff --git third_party/libwebrtc/modules/audio_processing/audio_processing_gn/moz.build third_party/libwebrtc/modules/audio_processing/audio_processing_gn/moz.build
index 10be557444b1..786ef149fe84 100644
--- third_party/libwebrtc/modules/audio_processing/audio_processing_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/audio_processing_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -50,190 +59,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_processing_gn")
diff --git third_party/libwebrtc/modules/audio_processing/capture_levels_adjuster/capture_levels_adjuster_gn/moz.build third_party/libwebrtc/modules/audio_processing/capture_levels_adjuster/capture_levels_adjuster_gn/moz.build
index 7eabe2166f96..bc2da883b302 100644
--- third_party/libwebrtc/modules/audio_processing/capture_levels_adjuster/capture_levels_adjuster_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/capture_levels_adjuster/capture_levels_adjuster_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("capture_levels_adjuster_gn")
diff --git third_party/libwebrtc/modules/audio_processing/gain_controller2_gn/moz.build third_party/libwebrtc/modules/audio_processing/gain_controller2_gn/moz.build
index 7c590c1c04e4..10ca80187523 100644
--- third_party/libwebrtc/modules/audio_processing/gain_controller2_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/gain_controller2_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("gain_controller2_gn")
diff --git third_party/libwebrtc/modules/audio_processing/high_pass_filter_gn/moz.build third_party/libwebrtc/modules/audio_processing/high_pass_filter_gn/moz.build
index 2a5c6b124653..088eaeabf901 100644
--- third_party/libwebrtc/modules/audio_processing/high_pass_filter_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/high_pass_filter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("high_pass_filter_gn")
diff --git third_party/libwebrtc/modules/audio_processing/ns/ns_gn/moz.build third_party/libwebrtc/modules/audio_processing/ns/ns_gn/moz.build
index cea8ba8d8132..b7191f1399a0 100644
--- third_party/libwebrtc/modules/audio_processing/ns/ns_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/ns/ns_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -57,190 +66,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("ns_gn")
diff --git third_party/libwebrtc/modules/audio_processing/rms_level_gn/moz.build third_party/libwebrtc/modules/audio_processing/rms_level_gn/moz.build
index c6d670a9716f..0b6a724bea6a 100644
--- third_party/libwebrtc/modules/audio_processing/rms_level_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/rms_level_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rms_level_gn")
diff --git third_party/libwebrtc/modules/audio_processing/utility/cascaded_biquad_filter_gn/moz.build third_party/libwebrtc/modules/audio_processing/utility/cascaded_biquad_filter_gn/moz.build
index 9b82be1adb86..e85813c9141a 100644
--- third_party/libwebrtc/modules/audio_processing/utility/cascaded_biquad_filter_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/utility/cascaded_biquad_filter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("cascaded_biquad_filter_gn")
diff --git third_party/libwebrtc/modules/audio_processing/utility/legacy_delay_estimator_gn/moz.build third_party/libwebrtc/modules/audio_processing/utility/legacy_delay_estimator_gn/moz.build
index 4692680bae55..dc7c1b23536a 100644
--- third_party/libwebrtc/modules/audio_processing/utility/legacy_delay_estimator_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/utility/legacy_delay_estimator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,179 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("legacy_delay_estimator_gn")
diff --git third_party/libwebrtc/modules/audio_processing/utility/pffft_wrapper_gn/moz.build third_party/libwebrtc/modules/audio_processing/utility/pffft_wrapper_gn/moz.build
index 609567fd1543..7a6396d4b7a7 100644
--- third_party/libwebrtc/modules/audio_processing/utility/pffft_wrapper_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/utility/pffft_wrapper_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("pffft_wrapper_gn")
diff --git third_party/libwebrtc/modules/audio_processing/vad/vad_gn/moz.build third_party/libwebrtc/modules/audio_processing/vad/vad_gn/moz.build
index e18fa6a13dc5..651adb31c8f8 100644
--- third_party/libwebrtc/modules/audio_processing/vad/vad_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/vad/vad_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -51,190 +60,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("vad_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/congestion_controller_gn/moz.build third_party/libwebrtc/modules/congestion_controller/congestion_controller_gn/moz.build
index d445a31d3fc0..6003c6b22afb 100644
--- third_party/libwebrtc/modules/congestion_controller/congestion_controller_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/congestion_controller_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,191 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("congestion_controller_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/goog_cc/alr_detector_gn/moz.build third_party/libwebrtc/modules/congestion_controller/goog_cc/alr_detector_gn/moz.build
index 15b360f97098..7565e2a3de43 100644
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/alr_detector_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/alr_detector_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("alr_detector_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_gn/moz.build third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_gn/moz.build
index dcc10a6e047f..3ee2ade0e6e2 100644
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,191 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("delay_based_bwe_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/goog_cc/estimators_gn/moz.build third_party/libwebrtc/modules/congestion_controller/goog_cc/estimators_gn/moz.build
index cba0035df095..b05566a84bd9 100644
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/estimators_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/estimators_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -49,190 +58,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("estimators_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_gn/moz.build third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_gn/moz.build
index 52ac4f397915..9c83648d1d91 100644
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("goog_cc_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/goog_cc/link_capacity_estimator_gn/moz.build third_party/libwebrtc/modules/congestion_controller/goog_cc/link_capacity_estimator_gn/moz.build
index 116a29107a5f..210869b7d740 100644
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/link_capacity_estimator_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/link_capacity_estimator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("link_capacity_estimator_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v1_gn/moz.build third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v1_gn/moz.build
index 35f9c99e87f4..4886c9836d50 100644
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v1_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v1_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("loss_based_bwe_v1_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2_gn/moz.build third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2_gn/moz.build
index 6ce1de1fa51c..0bc507c37d93 100644
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("loss_based_bwe_v2_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/goog_cc/probe_controller_gn/moz.build third_party/libwebrtc/modules/congestion_controller/goog_cc/probe_controller_gn/moz.build
index 28aacf038f32..d8bd001c8e6d 100644
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/probe_controller_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/probe_controller_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("probe_controller_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/goog_cc/pushback_controller_gn/moz.build third_party/libwebrtc/modules/congestion_controller/goog_cc/pushback_controller_gn/moz.build
index ac8867e70538..529154c4b5e7 100644
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/pushback_controller_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/pushback_controller_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("pushback_controller_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bwe_gn/moz.build third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bwe_gn/moz.build
index 7d00add70158..383d7aa7785b 100644
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bwe_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bwe_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("send_side_bwe_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/rtp/control_handler_gn/moz.build third_party/libwebrtc/modules/congestion_controller/rtp/control_handler_gn/moz.build
index e851772ea7b7..97574a0d1d13 100644
--- third_party/libwebrtc/modules/congestion_controller/rtp/control_handler_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/rtp/control_handler_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("control_handler_gn")
diff --git third_party/libwebrtc/modules/congestion_controller/rtp/transport_feedback_gn/moz.build third_party/libwebrtc/modules/congestion_controller/rtp/transport_feedback_gn/moz.build
index d86d84b32b52..5a4efa68c0c2 100644
--- third_party/libwebrtc/modules/congestion_controller/rtp/transport_feedback_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/rtp/transport_feedback_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("transport_feedback_gn")
diff --git third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn/moz.build third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn/moz.build
index a467463de4d3..3c0d102a3516 100644
--- third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn/moz.build
+++ third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_AVX2"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,111 +54,23 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
+    DEFINES["_DEBUG"] = True
 
-if CONFIG["OS_TARGET"] == "Darwin":
+if CONFIG["TARGET_CPU"] == "x86":
 
     CXXFLAGS += [
+        "-msse2",
         "-msse2"
     ]
 
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
+if CONFIG["TARGET_CPU"] == "x86_64":
 
     CXXFLAGS += [
         "-msse2"
     ]
 
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    CXXFLAGS += [
-        "-msse2",
-        "-msse2"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    CXXFLAGS += [
-        "-msse2"
-    ]
-
 Library("desktop_capture_differ_sse2_gn")
diff --git third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build
index bd438bdda18a..b7c18f5bd2df 100644
--- third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build
+++ third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build
@@ -26,11 +26,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -82,186 +91,13 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/mac/desktop_configuration_monitor.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/mac/desktop_frame_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/mac/full_screen_mac_application_handler.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/mac/window_list_utils.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-    SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_linux.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_linux.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["WEBRTC_USE_X11"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "X11",
-        "Xcomposite",
-        "Xdamage",
-        "Xext",
-        "Xfixes",
-        "Xrandr",
-        "Xrender"
-    ]
-
-    SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/screen_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/shared_x_display.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_finder_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_list_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_atom_cache.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_error_trap.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_window_property.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_linux.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_linux.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "d3d11",
-        "dwmapi",
-        "dxgi",
-        "iphlpapi",
-        "secur32",
-        "shcore",
-        "winmm"
-    ]
-
-    SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/cropping_window_capturer_win.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_frame_win.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_win.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_win.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/cursor.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/d3d_device.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/desktop.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/desktop_capture_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/display_configuration_monitor.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/dxgi_context.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/dxgi_duplicator_controller.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/dxgi_frame.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/dxgi_output_duplicator.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/dxgi_texture.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/dxgi_texture_mapping.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/dxgi_texture_staging.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/full_screen_win_application_handler.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/scoped_thread_desktop.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/screen_capture_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/selected_window_context.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/wgc_capture_session.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/wgc_capture_source.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/wgc_capturer_win.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/wgc_desktop_frame.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/window_capture_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/win/window_capturer_win_gdi.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_win.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/window_finder_win.cc"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/gfx/angle/checkout/include/",
@@ -269,7 +105,8 @@ if CONFIG["TARGET_CPU"] == "arm":
     ]
 
     SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc"
     ]
 
     UNIFIED_SOURCES += [
@@ -279,36 +116,9 @@ if CONFIG["TARGET_CPU"] == "arm":
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screen_capture_portal_interface.cc",
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_portal.cc",
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_stream_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc"
-    ]
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_USE_X11"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-    OS_LIBS += [
-        "X11",
-        "Xcomposite",
-        "Xdamage",
-        "Xext",
-        "Xfixes",
-        "Xrandr",
-        "Xrender"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/screen_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/shared_x_display.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_finder_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_list_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_atom_cache.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_error_trap.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_window_property.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_linux.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_linux.cc"
     ]
 
 if CONFIG["TARGET_CPU"] == "mips32":
@@ -316,7 +126,6 @@ if CONFIG["TARGET_CPU"] == "mips32":
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/gfx/angle/checkout/include/",
@@ -324,7 +133,8 @@ if CONFIG["TARGET_CPU"] == "mips32":
     ]
 
     SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc"
     ]
 
     UNIFIED_SOURCES += [
@@ -334,13 +144,14 @@ if CONFIG["TARGET_CPU"] == "mips32":
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screen_capture_portal_interface.cc",
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_portal.cc",
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_stream_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_linux.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_linux.cc"
     ]
 
 if CONFIG["TARGET_CPU"] == "mips64":
 
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/gfx/angle/checkout/include/",
@@ -348,7 +159,8 @@ if CONFIG["TARGET_CPU"] == "mips64":
     ]
 
     SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc"
     ]
 
     UNIFIED_SOURCES += [
@@ -358,121 +170,19 @@ if CONFIG["TARGET_CPU"] == "mips64":
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screen_capture_portal_interface.cc",
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_portal.cc",
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_stream_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc"
-    ]
-
-if CONFIG["TARGET_CPU"] == "ppc64":
-
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_USE_X11"] = True
-
-    OS_LIBS += [
-        "X11",
-        "Xcomposite",
-        "Xdamage",
-        "Xext",
-        "Xfixes",
-        "Xrandr",
-        "Xrender"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/screen_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/shared_x_display.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_finder_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_list_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_atom_cache.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_error_trap.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_window_property.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_linux.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_linux.cc"
     ]
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-    LOCAL_INCLUDES += [
-        "/gfx/angle/checkout/include/",
-        "/third_party/libepoxy/libepoxy/include/"
-    ]
-
-    SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/mouse_cursor_monitor_pipewire.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/restore_token_manager.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screen_capture_portal_interface.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_portal.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_stream_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "riscv64":
-
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_USE_X11"] = True
-
-    OS_LIBS += [
-        "X11",
-        "Xcomposite",
-        "Xdamage",
-        "Xext",
-        "Xfixes",
-        "Xrandr",
-        "Xrender"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/screen_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/shared_x_display.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_finder_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_list_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_atom_cache.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_error_trap.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_window_property.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/gfx/angle/checkout/include/",
@@ -480,7 +190,8 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
     ]
 
     SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc"
     ]
 
     UNIFIED_SOURCES += [
@@ -490,13 +201,15 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screen_capture_portal_interface.cc",
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_portal.cc",
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_stream_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_linux.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_linux.cc"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["TARGET_CPU"] == "x86_64":
 
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/gfx/angle/checkout/include/",
@@ -504,7 +217,8 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
     ]
 
     SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc"
     ]
 
     UNIFIED_SOURCES += [
@@ -514,10 +228,12 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screen_capture_portal_interface.cc",
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_portal.cc",
         "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/screencast_stream_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_linux.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_linux.cc"
     ]
 
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
     DEFINES["WEBRTC_USE_X11"] = True
@@ -545,144 +261,61 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGE
         "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_window_property.cc"
     ]
 
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_USE_X11"] = True
-
-    OS_LIBS += [
-        "X11",
-        "Xcomposite",
-        "Xdamage",
-        "Xext",
-        "Xfixes",
-        "Xrandr",
-        "Xrender"
-    ]
+if not CONFIG["MOZ_X11"] and CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "loongarch64":
 
     UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/screen_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/shared_x_display.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_finder_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_list_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_atom_cache.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_error_trap.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_window_property.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_null.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_null.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_null.cc"
     ]
 
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "mips32":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "loongarch64":
 
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_USE_X11"] = True
-
-    OS_LIBS += [
-        "X11",
-        "Xcomposite",
-        "Xdamage",
-        "Xext",
-        "Xfixes",
-        "Xrandr",
-        "Xrender"
+    SOURCES += [
+        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc"
     ]
 
     UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/screen_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/shared_x_display.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_finder_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_list_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_atom_cache.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_error_trap.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_window_property.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_linux.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_linux.cc"
     ]
 
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_USE_X11"] = True
-
-    OS_LIBS += [
-        "X11",
-        "Xcomposite",
-        "Xdamage",
-        "Xext",
-        "Xfixes",
-        "Xrandr",
-        "Xrender"
-    ]
+if not CONFIG["MOZ_X11"] and CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "ppc64":
 
     UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/screen_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/shared_x_display.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_finder_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_list_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_atom_cache.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_error_trap.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_window_property.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_null.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_null.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_null.cc"
     ]
 
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_USE_X11"] = True
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "ppc64":
 
-    OS_LIBS += [
-        "X11",
-        "Xcomposite",
-        "Xdamage",
-        "Xext",
-        "Xfixes",
-        "Xrandr",
-        "Xrender"
+    SOURCES += [
+        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc"
     ]
 
     UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/screen_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/shared_x_display.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_finder_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_list_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_atom_cache.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_error_trap.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_window_property.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_linux.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_linux.cc"
     ]
 
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if not CONFIG["MOZ_X11"] and CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "riscv64":
 
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_USE_X11"] = True
+    UNIFIED_SOURCES += [
+        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_null.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_null.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_null.cc"
+    ]
 
-    OS_LIBS += [
-        "X11",
-        "Xcomposite",
-        "Xdamage",
-        "Xext",
-        "Xfixes",
-        "Xrandr",
-        "Xrender"
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "riscv64":
+
+    SOURCES += [
+        "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc"
     ]
 
     UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/screen_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/shared_x_display.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_capturer_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_finder_x11.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/window_list_utils.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_atom_cache.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_error_trap.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc",
-        "/third_party/libwebrtc/modules/desktop_capture/linux/x11/x_window_property.cc"
+        "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_linux.cc",
+        "/third_party/libwebrtc/modules/desktop_capture/window_capturer_linux.cc"
     ]
 
 Library("desktop_capture_gn")
diff --git third_party/libwebrtc/modules/desktop_capture/desktop_capture_objc_gn/moz.build third_party/libwebrtc/modules/desktop_capture/desktop_capture_objc_gn/moz.build
deleted file mode 100644
index 6dfb588a9b3e..000000000000
--- third_party/libwebrtc/modules/desktop_capture/desktop_capture_objc_gn/moz.build
+++ /dev/null
@@ -1,80 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-CMMFLAGS += [
-    "-fobjc-arc"
-]
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MAC"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_POSIX"] = True
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-DEFINES["__STDC_CONSTANT_MACROS"] = True
-DEFINES["__STDC_FORMAT_MACROS"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/third_party/libwebrtc/sdk/objc/",
-    "/third_party/libwebrtc/sdk/objc/base/",
-    "/tools/profiler/public"
-]
-
-UNIFIED_SOURCES += [
-    "/third_party/libwebrtc/modules/desktop_capture/mac/desktop_configuration.mm",
-    "/third_party/libwebrtc/modules/desktop_capture/mac/desktop_frame_cgimage.mm",
-    "/third_party/libwebrtc/modules/desktop_capture/mac/desktop_frame_iosurface.mm",
-    "/third_party/libwebrtc/modules/desktop_capture/mac/desktop_frame_provider.mm",
-    "/third_party/libwebrtc/modules/desktop_capture/mac/sck_picker_handle.mm",
-    "/third_party/libwebrtc/modules/desktop_capture/mac/screen_capturer_mac.mm",
-    "/third_party/libwebrtc/modules/desktop_capture/mac/screen_capturer_sck.mm",
-    "/third_party/libwebrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm",
-    "/third_party/libwebrtc/modules/desktop_capture/screen_capturer_darwin.mm",
-    "/third_party/libwebrtc/modules/desktop_capture/window_capturer_mac.mm",
-    "/third_party/libwebrtc/modules/desktop_capture/window_finder_mac.mm"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("desktop_capture_objc_gn")
diff --git third_party/libwebrtc/modules/desktop_capture/primitives_gn/moz.build third_party/libwebrtc/modules/desktop_capture/primitives_gn/moz.build
index 72bf241d547a..ad186a14f80e 100644
--- third_party/libwebrtc/modules/desktop_capture/primitives_gn/moz.build
+++ third_party/libwebrtc/modules/desktop_capture/primitives_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -50,171 +59,31 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["USE_X11"] = "1"
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "ppc64":
-
-    DEFINES["USE_X11"] = "1"
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "riscv64":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "mips32":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["USE_X11"] = "1"
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["USE_X11"] = "1"
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
diff --git third_party/libwebrtc/modules/module_api_gn/moz.build third_party/libwebrtc/modules/module_api_gn/moz.build
index c74dc2329ad2..05900bc205d7 100644
--- third_party/libwebrtc/modules/module_api_gn/moz.build
+++ third_party/libwebrtc/modules/module_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("module_api_gn")
diff --git third_party/libwebrtc/modules/module_api_public_gn/moz.build third_party/libwebrtc/modules/module_api_public_gn/moz.build
index 2eda098fe6fe..e83796e2fe16 100644
--- third_party/libwebrtc/modules/module_api_public_gn/moz.build
+++ third_party/libwebrtc/modules/module_api_public_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("module_api_public_gn")
diff --git third_party/libwebrtc/modules/module_fec_api_gn/moz.build third_party/libwebrtc/modules/module_fec_api_gn/moz.build
index d2c1054abbb3..aacac81ad58d 100644
--- third_party/libwebrtc/modules/module_fec_api_gn/moz.build
+++ third_party/libwebrtc/modules/module_fec_api_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("module_fec_api_gn")
diff --git third_party/libwebrtc/modules/pacing/interval_budget_gn/moz.build third_party/libwebrtc/modules/pacing/interval_budget_gn/moz.build
index dbad013ebaab..874ca10c419f 100644
--- third_party/libwebrtc/modules/pacing/interval_budget_gn/moz.build
+++ third_party/libwebrtc/modules/pacing/interval_budget_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("interval_budget_gn")
diff --git third_party/libwebrtc/modules/pacing/pacing_gn/moz.build third_party/libwebrtc/modules/pacing/pacing_gn/moz.build
index 5c92e55d39bc..9009b4168a4a 100644
--- third_party/libwebrtc/modules/pacing/pacing_gn/moz.build
+++ third_party/libwebrtc/modules/pacing/pacing_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -51,191 +60,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("pacing_gn")
diff --git third_party/libwebrtc/modules/portal/portal_gn/moz.build third_party/libwebrtc/modules/portal/portal_gn/moz.build
index ee6619253f99..a10c69da5e79 100644
--- third_party/libwebrtc/modules/portal/portal_gn/moz.build
+++ third_party/libwebrtc/modules/portal/portal_gn/moz.build
@@ -26,21 +26,17 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["USE_AURA"] = "1"
 DEFINES["USE_GLIB"] = "1"
-DEFINES["USE_NSS_CERTS"] = "1"
 DEFINES["USE_OZONE"] = "1"
-DEFINES["USE_UDEV"] = True
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_LINUX"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
 DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
 DEFINES["WEBRTC_USE_PIPEWIRE"] = True
 DEFINES["_FILE_OFFSET_BITS"] = "64"
-DEFINES["_GNU_SOURCE"] = True
 DEFINES["_LARGEFILE64_SOURCE"] = True
 DEFINES["_LARGEFILE_SOURCE"] = True
 DEFINES["__STDC_CONSTANT_MACROS"] = True
@@ -82,16 +78,6 @@ if CONFIG["TARGET_CPU"] == "aarch64":
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
@@ -109,7 +95,7 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
diff --git third_party/libwebrtc/modules/remote_bitrate_estimator/congestion_control_feedback_generator_gn/moz.build third_party/libwebrtc/modules/remote_bitrate_estimator/congestion_control_feedback_generator_gn/moz.build
index 0e74f3d662be..6c6ff431f9cd 100644
--- third_party/libwebrtc/modules/remote_bitrate_estimator/congestion_control_feedback_generator_gn/moz.build
+++ third_party/libwebrtc/modules/remote_bitrate_estimator/congestion_control_feedback_generator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("congestion_control_feedback_generator_gn")
diff --git third_party/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_gn/moz.build third_party/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_gn/moz.build
index 0476715240a8..1f2aa0c4a22a 100644
--- third_party/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_gn/moz.build
+++ third_party/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -53,190 +62,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("remote_bitrate_estimator_gn")
diff --git third_party/libwebrtc/modules/remote_bitrate_estimator/rtp_transport_feedback_generator_gn/moz.build third_party/libwebrtc/modules/remote_bitrate_estimator/rtp_transport_feedback_generator_gn/moz.build
index 8a7680e3abc4..e299f01db387 100644
--- third_party/libwebrtc/modules/remote_bitrate_estimator/rtp_transport_feedback_generator_gn/moz.build
+++ third_party/libwebrtc/modules/remote_bitrate_estimator/rtp_transport_feedback_generator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,123 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -166,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rtp_transport_feedback_generator_gn")
diff --git third_party/libwebrtc/modules/remote_bitrate_estimator/transport_sequence_number_feedback_generator_gn/moz.build third_party/libwebrtc/modules/remote_bitrate_estimator/transport_sequence_number_feedback_generator_gn/moz.build
index d85dcbe3e6ba..3383c0082bf9 100644
--- third_party/libwebrtc/modules/remote_bitrate_estimator/transport_sequence_number_feedback_generator_gn/moz.build
+++ third_party/libwebrtc/modules/remote_bitrate_estimator/transport_sequence_number_feedback_generator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("transport_sequence_number_feedback_generator_gn")
diff --git third_party/libwebrtc/modules/rtp_rtcp/leb128_gn/moz.build third_party/libwebrtc/modules/rtp_rtcp/leb128_gn/moz.build
index e3cb470c6df3..ba3510e10044 100644
--- third_party/libwebrtc/modules/rtp_rtcp/leb128_gn/moz.build
+++ third_party/libwebrtc/modules/rtp_rtcp/leb128_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("leb128_gn")
diff --git third_party/libwebrtc/modules/rtp_rtcp/ntp_time_util_gn/moz.build third_party/libwebrtc/modules/rtp_rtcp/ntp_time_util_gn/moz.build
index 82b258c97e2a..9413e74bf451 100644
--- third_party/libwebrtc/modules/rtp_rtcp/ntp_time_util_gn/moz.build
+++ third_party/libwebrtc/modules/rtp_rtcp/ntp_time_util_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("ntp_time_util_gn")
diff --git third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_format_gn/moz.build third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_format_gn/moz.build
index aabfc69f25b7..0ea4d705891b 100644
--- third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_format_gn/moz.build
+++ third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_format_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -88,190 +97,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtp_rtcp_format_gn")
diff --git third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_gn/moz.build third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_gn/moz.build
index 802375393ae2..c3e90068aa32 100644
--- third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_gn/moz.build
+++ third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -98,191 +107,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtp_rtcp_gn")
diff --git third_party/libwebrtc/modules/rtp_rtcp/rtp_video_header_gn/moz.build third_party/libwebrtc/modules/rtp_rtcp/rtp_video_header_gn/moz.build
index 97656d77e72f..601db653d6b4 100644
--- third_party/libwebrtc/modules/rtp_rtcp/rtp_video_header_gn/moz.build
+++ third_party/libwebrtc/modules/rtp_rtcp/rtp_video_header_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtp_video_header_gn")
diff --git third_party/libwebrtc/modules/third_party/fft/fft_gn/moz.build third_party/libwebrtc/modules/third_party/fft/fft_gn/moz.build
index 1ace30b6be87..a70c2f504f0a 100644
--- third_party/libwebrtc/modules/third_party/fft/fft_gn/moz.build
+++ third_party/libwebrtc/modules/third_party/fft/fft_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("fft_gn")
diff --git third_party/libwebrtc/modules/third_party/g711/g711_3p_gn/moz.build third_party/libwebrtc/modules/third_party/g711/g711_3p_gn/moz.build
index 54f41d0579ad..5c4296426bc2 100644
--- third_party/libwebrtc/modules/third_party/g711/g711_3p_gn/moz.build
+++ third_party/libwebrtc/modules/third_party/g711/g711_3p_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("g711_3p_gn")
diff --git third_party/libwebrtc/modules/third_party/g722/g722_3p_gn/moz.build third_party/libwebrtc/modules/third_party/g722/g722_3p_gn/moz.build
index 1f21b3fea9d8..7a39abd06a9a 100644
--- third_party/libwebrtc/modules/third_party/g722/g722_3p_gn/moz.build
+++ third_party/libwebrtc/modules/third_party/g722/g722_3p_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -48,175 +57,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("g722_3p_gn")
diff --git third_party/libwebrtc/modules/utility/utility_gn/moz.build third_party/libwebrtc/modules/utility/utility_gn/moz.build
index fa5016332f35..76f5db2df779 100644
--- third_party/libwebrtc/modules/utility/utility_gn/moz.build
+++ third_party/libwebrtc/modules/utility/utility_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,116 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/utility/source/helpers_android.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -159,60 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
-    CXXFLAGS += [
-        "-msse2"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("utility_gn")
diff --git third_party/libwebrtc/modules/video_capture/video_capture_internal_impl_gn/moz.build third_party/libwebrtc/modules/video_capture/video_capture_internal_impl_gn/moz.build
index 0bbab186040b..16ac438454b8 100644
--- third_party/libwebrtc/modules/video_capture/video_capture_internal_impl_gn/moz.build
+++ third_party/libwebrtc/modules/video_capture/video_capture_internal_impl_gn/moz.build
@@ -18,11 +18,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -37,6 +46,10 @@ LOCAL_INCLUDES += [
 ]
 
 UNIFIED_SOURCES += [
+    "/third_party/libwebrtc/modules/video_capture/linux/device_info_linux.cc",
+    "/third_party/libwebrtc/modules/video_capture/linux/device_info_v4l2.cc",
+    "/third_party/libwebrtc/modules/video_capture/linux/video_capture_linux.cc",
+    "/third_party/libwebrtc/modules/video_capture/linux/video_capture_v4l2.cc",
     "/third_party/libwebrtc/modules/video_capture/video_capture_options.cc"
 ]
 
@@ -49,170 +62,13 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/video_capture/linux/device_info_linux.cc",
-        "/third_party/libwebrtc/modules/video_capture/linux/device_info_v4l2.cc",
-        "/third_party/libwebrtc/modules/video_capture/linux/video_capture_linux.cc",
-        "/third_party/libwebrtc/modules/video_capture/linux/video_capture_v4l2.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/video_capture/linux/device_info_linux.cc",
-        "/third_party/libwebrtc/modules/video_capture/linux/device_info_v4l2.cc",
-        "/third_party/libwebrtc/modules/video_capture/linux/video_capture_linux.cc",
-        "/third_party/libwebrtc/modules/video_capture/linux/video_capture_v4l2.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "ole32",
-        "oleaut32",
-        "secur32",
-        "strmiids",
-        "user32",
-        "winmm"
-    ]
-
-    SOURCES += [
-        "/third_party/libwebrtc/modules/video_capture/windows/device_info_ds.cc",
-        "/third_party/libwebrtc/modules/video_capture/windows/help_functions_ds.cc",
-        "/third_party/libwebrtc/modules/video_capture/windows/sink_filter_ds.cc"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/video_capture/windows/video_capture_ds.cc",
-        "/third_party/libwebrtc/modules/video_capture/windows/video_capture_factory_windows.cc"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips32":
-
-    DEFINES["MIPS32_LE"] = True
-    DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-    LOCAL_INCLUDES += [
-        "/gfx/angle/checkout/include/",
-        "/third_party/libepoxy/libepoxy/include/"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/modules/video_capture/linux/camera_portal.cc",
-        "/third_party/libwebrtc/modules/video_capture/linux/device_info_pipewire.cc",
-        "/third_party/libwebrtc/modules/video_capture/linux/pipewire_session.cc",
-        "/third_party/libwebrtc/modules/video_capture/linux/video_capture_pipewire.cc"
-    ]
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/gfx/angle/checkout/include/",
@@ -226,54 +82,11 @@ if CONFIG["TARGET_CPU"] == "mips64":
         "/third_party/libwebrtc/modules/video_capture/linux/video_capture_pipewire.cc"
     ]
 
-if CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
-    CXXFLAGS += [
-        "-msse2"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
+if CONFIG["TARGET_CPU"] == "mips32":
 
+    DEFINES["MIPS32_LE"] = True
+    DEFINES["MIPS_FPU_LE"] = True
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/gfx/angle/checkout/include/",
@@ -287,10 +100,9 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
         "/third_party/libwebrtc/modules/video_capture/linux/video_capture_pipewire.cc"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
+if CONFIG["TARGET_CPU"] == "mips64":
 
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/gfx/angle/checkout/include/",
@@ -304,14 +116,14 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
         "/third_party/libwebrtc/modules/video_capture/linux/video_capture_pipewire.cc"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["TARGET_CPU"] == "x86":
 
     CXXFLAGS += [
         "-msse2"
     ]
 
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/gfx/angle/checkout/include/",
@@ -325,10 +137,10 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
         "/third_party/libwebrtc/modules/video_capture/linux/video_capture_pipewire.cc"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["TARGET_CPU"] == "x86_64":
 
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/gfx/angle/checkout/include/",
@@ -342,4 +154,8 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
         "/third_party/libwebrtc/modules/video_capture/linux/video_capture_pipewire.cc"
     ]
 
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
+
+    DEFINES["USE_X11"] = "1"
+
 Library("video_capture_internal_impl_gn")
diff --git third_party/libwebrtc/modules/video_capture/video_capture_module_gn/moz.build third_party/libwebrtc/modules/video_capture/video_capture_module_gn/moz.build
index 63ea4f06c231..0a5aa0faeb03 100644
--- third_party/libwebrtc/modules/video_capture/video_capture_module_gn/moz.build
+++ third_party/libwebrtc/modules/video_capture/video_capture_module_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -48,190 +57,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_capture_module_gn")
diff --git third_party/libwebrtc/modules/video_coding/chain_diff_calculator_gn/moz.build third_party/libwebrtc/modules/video_coding/chain_diff_calculator_gn/moz.build
index 2df6e3909ab8..db15b3bf5bca 100644
--- third_party/libwebrtc/modules/video_coding/chain_diff_calculator_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/chain_diff_calculator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("chain_diff_calculator_gn")
diff --git third_party/libwebrtc/modules/video_coding/codec_globals_headers_gn/moz.build third_party/libwebrtc/modules/video_coding/codec_globals_headers_gn/moz.build
index 45a85d4689af..7524313fb884 100644
--- third_party/libwebrtc/modules/video_coding/codec_globals_headers_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/codec_globals_headers_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("codec_globals_headers_gn")
diff --git third_party/libwebrtc/modules/video_coding/codecs/av1/av1_svc_config_gn/moz.build third_party/libwebrtc/modules/video_coding/codecs/av1/av1_svc_config_gn/moz.build
index 2fece80bce22..9fe0c94db192 100644
--- third_party/libwebrtc/modules/video_coding/codecs/av1/av1_svc_config_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/codecs/av1/av1_svc_config_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("av1_svc_config_gn")
diff --git third_party/libwebrtc/modules/video_coding/codecs/av1/dav1d_decoder_gn/moz.build third_party/libwebrtc/modules/video_coding/codecs/av1/dav1d_decoder_gn/moz.build
index 838868858004..04f426de8930 100644
--- third_party/libwebrtc/modules/video_coding/codecs/av1/dav1d_decoder_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/codecs/av1/dav1d_decoder_gn/moz.build
@@ -16,11 +16,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -51,186 +60,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("dav1d_decoder_gn")
diff --git third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_encoder_gn/moz.build third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_encoder_gn/moz.build
index 7ebe8089b1b2..0ef5c393600b 100644
--- third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_encoder_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_encoder_gn/moz.build
@@ -16,11 +16,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,190 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("aom_av1_encoder_gn")
diff --git third_party/libwebrtc/modules/video_coding/encoded_frame_gn/moz.build third_party/libwebrtc/modules/video_coding/encoded_frame_gn/moz.build
index ee69c451a535..6416e975e2f7 100644
--- third_party/libwebrtc/modules/video_coding/encoded_frame_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/encoded_frame_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("encoded_frame_gn")
diff --git third_party/libwebrtc/modules/video_coding/frame_dependencies_calculator_gn/moz.build third_party/libwebrtc/modules/video_coding/frame_dependencies_calculator_gn/moz.build
index aa42f12b7b5b..40f1449e2b22 100644
--- third_party/libwebrtc/modules/video_coding/frame_dependencies_calculator_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/frame_dependencies_calculator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frame_dependencies_calculator_gn")
diff --git third_party/libwebrtc/modules/video_coding/frame_helpers_gn/moz.build third_party/libwebrtc/modules/video_coding/frame_helpers_gn/moz.build
index ab164d5d921f..fe1dd7c20635 100644
--- third_party/libwebrtc/modules/video_coding/frame_helpers_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/frame_helpers_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frame_helpers_gn")
diff --git third_party/libwebrtc/modules/video_coding/h264_sprop_parameter_sets_gn/moz.build third_party/libwebrtc/modules/video_coding/h264_sprop_parameter_sets_gn/moz.build
index 6527c200d000..e5dd51284982 100644
--- third_party/libwebrtc/modules/video_coding/h264_sprop_parameter_sets_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/h264_sprop_parameter_sets_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("h264_sprop_parameter_sets_gn")
diff --git third_party/libwebrtc/modules/video_coding/h26x_packet_buffer_gn/moz.build third_party/libwebrtc/modules/video_coding/h26x_packet_buffer_gn/moz.build
index cde385e9a546..5f57f69fd4a0 100644
--- third_party/libwebrtc/modules/video_coding/h26x_packet_buffer_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/h26x_packet_buffer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("h26x_packet_buffer_gn")
diff --git third_party/libwebrtc/modules/video_coding/nack_requester_gn/moz.build third_party/libwebrtc/modules/video_coding/nack_requester_gn/moz.build
index 84955a5ef85a..4a468f527ed4 100644
--- third_party/libwebrtc/modules/video_coding/nack_requester_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/nack_requester_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,190 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("nack_requester_gn")
diff --git third_party/libwebrtc/modules/video_coding/packet_buffer_gn/moz.build third_party/libwebrtc/modules/video_coding/packet_buffer_gn/moz.build
index 1376ef845e41..d4f7694767ba 100644
--- third_party/libwebrtc/modules/video_coding/packet_buffer_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/packet_buffer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("packet_buffer_gn")
diff --git third_party/libwebrtc/modules/video_coding/svc/scalability_mode_util_gn/moz.build third_party/libwebrtc/modules/video_coding/svc/scalability_mode_util_gn/moz.build
index 59753f7db18e..f305df0162af 100644
--- third_party/libwebrtc/modules/video_coding/svc/scalability_mode_util_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/svc/scalability_mode_util_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("scalability_mode_util_gn")
diff --git third_party/libwebrtc/modules/video_coding/svc/scalability_structures_gn/moz.build third_party/libwebrtc/modules/video_coding/svc/scalability_structures_gn/moz.build
index 0e0a68b5126f..40ba86c82948 100644
--- third_party/libwebrtc/modules/video_coding/svc/scalability_structures_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/svc/scalability_structures_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -51,186 +60,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("scalability_structures_gn")
diff --git third_party/libwebrtc/modules/video_coding/svc/scalable_video_controller_gn/moz.build third_party/libwebrtc/modules/video_coding/svc/scalable_video_controller_gn/moz.build
index 518157bf6a3a..728277abedb9 100644
--- third_party/libwebrtc/modules/video_coding/svc/scalable_video_controller_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/svc/scalable_video_controller_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("scalable_video_controller_gn")
diff --git third_party/libwebrtc/modules/video_coding/svc/simulcast_to_svc_converter_gn/moz.build third_party/libwebrtc/modules/video_coding/svc/simulcast_to_svc_converter_gn/moz.build
index 7beea9790f44..0b566d46220f 100644
--- third_party/libwebrtc/modules/video_coding/svc/simulcast_to_svc_converter_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/svc/simulcast_to_svc_converter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("simulcast_to_svc_converter_gn")
diff --git third_party/libwebrtc/modules/video_coding/svc/svc_rate_allocator_gn/moz.build third_party/libwebrtc/modules/video_coding/svc/svc_rate_allocator_gn/moz.build
index f2d5174579d7..70b9e280ac69 100644
--- third_party/libwebrtc/modules/video_coding/svc/svc_rate_allocator_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/svc/svc_rate_allocator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("svc_rate_allocator_gn")
diff --git third_party/libwebrtc/modules/video_coding/timing/decode_time_percentile_filter_gn/moz.build third_party/libwebrtc/modules/video_coding/timing/decode_time_percentile_filter_gn/moz.build
index 7896f5bc23b7..5351ae8eecb7 100644
--- third_party/libwebrtc/modules/video_coding/timing/decode_time_percentile_filter_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/timing/decode_time_percentile_filter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("decode_time_percentile_filter_gn")
diff --git third_party/libwebrtc/modules/video_coding/timing/frame_delay_variation_kalman_filter_gn/moz.build third_party/libwebrtc/modules/video_coding/timing/frame_delay_variation_kalman_filter_gn/moz.build
index 888feb78f5b1..94877208edd6 100644
--- third_party/libwebrtc/modules/video_coding/timing/frame_delay_variation_kalman_filter_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/timing/frame_delay_variation_kalman_filter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frame_delay_variation_kalman_filter_gn")
diff --git third_party/libwebrtc/modules/video_coding/timing/inter_frame_delay_variation_calculator_gn/moz.build third_party/libwebrtc/modules/video_coding/timing/inter_frame_delay_variation_calculator_gn/moz.build
index 90271d97710b..a89880e80b11 100644
--- third_party/libwebrtc/modules/video_coding/timing/inter_frame_delay_variation_calculator_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/timing/inter_frame_delay_variation_calculator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("inter_frame_delay_variation_calculator_gn")
diff --git third_party/libwebrtc/modules/video_coding/timing/jitter_estimator_gn/moz.build third_party/libwebrtc/modules/video_coding/timing/jitter_estimator_gn/moz.build
index 52b5cc106deb..c1b20efbd861 100644
--- third_party/libwebrtc/modules/video_coding/timing/jitter_estimator_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/timing/jitter_estimator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("jitter_estimator_gn")
diff --git third_party/libwebrtc/modules/video_coding/timing/rtt_filter_gn/moz.build third_party/libwebrtc/modules/video_coding/timing/rtt_filter_gn/moz.build
index 0e4c9ed34eec..bbd2ef7b0051 100644
--- third_party/libwebrtc/modules/video_coding/timing/rtt_filter_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/timing/rtt_filter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtt_filter_gn")
diff --git third_party/libwebrtc/modules/video_coding/timing/timestamp_extrapolator_gn/moz.build third_party/libwebrtc/modules/video_coding/timing/timestamp_extrapolator_gn/moz.build
index 91f53af3cd95..4039bf1225e2 100644
--- third_party/libwebrtc/modules/video_coding/timing/timestamp_extrapolator_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/timing/timestamp_extrapolator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("timestamp_extrapolator_gn")
diff --git third_party/libwebrtc/modules/video_coding/timing/timing_module_gn/moz.build third_party/libwebrtc/modules/video_coding/timing/timing_module_gn/moz.build
index 5a1fc368549b..ae936de55ec9 100644
--- third_party/libwebrtc/modules/video_coding/timing/timing_module_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/timing/timing_module_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("timing_module_gn")
diff --git third_party/libwebrtc/modules/video_coding/video_codec_interface_gn/moz.build third_party/libwebrtc/modules/video_coding/video_codec_interface_gn/moz.build
index 897eac22a94f..8124fea57658 100644
--- third_party/libwebrtc/modules/video_coding/video_codec_interface_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/video_codec_interface_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,186 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_codec_interface_gn")
diff --git third_party/libwebrtc/modules/video_coding/video_coding_gn/moz.build third_party/libwebrtc/modules/video_coding/video_coding_gn/moz.build
index 3ce6a18faa6b..2f30227606e2 100644
--- third_party/libwebrtc/modules/video_coding/video_coding_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/video_coding_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -57,191 +66,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_coding_gn")
diff --git third_party/libwebrtc/modules/video_coding/video_coding_utility_gn/moz.build third_party/libwebrtc/modules/video_coding/video_coding_utility_gn/moz.build
index 68fc0eae62dc..62b651290610 100644
--- third_party/libwebrtc/modules/video_coding/video_coding_utility_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/video_coding_utility_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -56,191 +65,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_coding_utility_gn")
diff --git third_party/libwebrtc/modules/video_coding/webrtc_h264_gn/moz.build third_party/libwebrtc/modules/video_coding/webrtc_h264_gn/moz.build
index 104bcded2bc7..ff4ed9fb888a 100644
--- third_party/libwebrtc/modules/video_coding/webrtc_h264_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/webrtc_h264_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -49,191 +58,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("webrtc_h264_gn")
diff --git third_party/libwebrtc/modules/video_coding/webrtc_libvpx_interface_gn/moz.build third_party/libwebrtc/modules/video_coding/webrtc_libvpx_interface_gn/moz.build
index efede3512ed7..af759b9e2900 100644
--- third_party/libwebrtc/modules/video_coding/webrtc_libvpx_interface_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/webrtc_libvpx_interface_gn/moz.build
@@ -16,11 +16,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,179 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("webrtc_libvpx_interface_gn")
diff --git third_party/libwebrtc/modules/video_coding/webrtc_vp8_gn/moz.build third_party/libwebrtc/modules/video_coding/webrtc_vp8_gn/moz.build
index 8c4f08bc82b5..7c863a57e8a8 100644
--- third_party/libwebrtc/modules/video_coding/webrtc_vp8_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/webrtc_vp8_gn/moz.build
@@ -16,11 +16,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -50,191 +59,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("webrtc_vp8_gn")
diff --git third_party/libwebrtc/modules/video_coding/webrtc_vp8_scalability_gn/moz.build third_party/libwebrtc/modules/video_coding/webrtc_vp8_scalability_gn/moz.build
index edf7e7b28f4f..9c7e190a11b4 100644
--- third_party/libwebrtc/modules/video_coding/webrtc_vp8_scalability_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/webrtc_vp8_scalability_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("webrtc_vp8_scalability_gn")
diff --git third_party/libwebrtc/modules/video_coding/webrtc_vp8_temporal_layers_gn/moz.build third_party/libwebrtc/modules/video_coding/webrtc_vp8_temporal_layers_gn/moz.build
index c92c78084ff3..3a5fb1aa4598 100644
--- third_party/libwebrtc/modules/video_coding/webrtc_vp8_temporal_layers_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/webrtc_vp8_temporal_layers_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -49,191 +58,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("webrtc_vp8_temporal_layers_gn")
diff --git third_party/libwebrtc/modules/video_coding/webrtc_vp9_gn/moz.build third_party/libwebrtc/modules/video_coding/webrtc_vp9_gn/moz.build
index ec4a3d7388f7..e891dd8b547f 100644
--- third_party/libwebrtc/modules/video_coding/webrtc_vp9_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/webrtc_vp9_gn/moz.build
@@ -16,11 +16,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -52,191 +61,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("webrtc_vp9_gn")
diff --git third_party/libwebrtc/modules/video_coding/webrtc_vp9_helpers_gn/moz.build third_party/libwebrtc/modules/video_coding/webrtc_vp9_helpers_gn/moz.build
index f8968c342f27..064b0b18e98c 100644
--- third_party/libwebrtc/modules/video_coding/webrtc_vp9_helpers_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/webrtc_vp9_helpers_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("webrtc_vp9_helpers_gn")
diff --git third_party/libwebrtc/moz.build third_party/libwebrtc/moz.build
index a45cc7826c9c..c4140609a28f 100644
--- third_party/libwebrtc/moz.build
+++ third_party/libwebrtc/moz.build
@@ -291,6 +291,8 @@ DIRS += [
     "/third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bwe_gn",
     "/third_party/libwebrtc/modules/congestion_controller/rtp/control_handler_gn",
     "/third_party/libwebrtc/modules/congestion_controller/rtp/transport_feedback_gn",
+    "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
+    "/third_party/libwebrtc/modules/desktop_capture/primitives_gn",
     "/third_party/libwebrtc/modules/module_api_gn",
     "/third_party/libwebrtc/modules/module_api_public_gn",
     "/third_party/libwebrtc/modules/module_fec_api_gn",
@@ -517,137 +519,30 @@ DIRS += [
     "/third_party/libwebrtc/webrtc_gn"
 ]
 
-if CONFIG["OS_TARGET"] == "Android":
-
-    DIRS += [
-        "/third_party/libwebrtc/rtc_base/ifaddrs_android_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DIRS += [
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_objc_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/primitives_gn",
-        "/third_party/libwebrtc/rtc_base/system/cocoa_threading_gn",
-        "/third_party/libwebrtc/rtc_base/system/gcd_helpers_gn",
-        "/third_party/libwebrtc/sdk/base_objc_gn",
-        "/third_party/libwebrtc/sdk/helpers_objc_gn",
-        "/third_party/libwebrtc/sdk/videocapture_objc_gn",
-        "/third_party/libwebrtc/sdk/videoframebuffer_objc_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DIRS += [
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/primitives_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DIRS += [
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/primitives_gn",
-        "/third_party/libwebrtc/rtc_base/win/create_direct3d_device_gn",
-        "/third_party/libwebrtc/rtc_base/win/get_activation_factory_gn",
-        "/third_party/libwebrtc/rtc_base/win/hstring_gn",
-        "/third_party/libwebrtc/rtc_base/win/windows_version_gn",
-        "/third_party/libwebrtc/rtc_base/win32_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DIRS += [
-        "/third_party/libwebrtc/common_audio/common_audio_neon_c_gn",
-        "/third_party/libwebrtc/common_audio/common_audio_neon_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    DIRS += [
-        "/third_party/libwebrtc/common_audio/common_audio_neon_c_gn",
-        "/third_party/libwebrtc/common_audio/common_audio_neon_gn",
-        "/third_party/libwebrtc/rtc_base/system/asm_defines_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
-    DIRS += [
-        "/third_party/libwebrtc/common_audio/common_audio_avx2_gn",
-        "/third_party/libwebrtc/common_audio/common_audio_sse2_gn",
-        "/third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn",
-        "/third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_avx2_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DIRS += [
-        "/third_party/libwebrtc/common_audio/common_audio_avx2_gn",
-        "/third_party/libwebrtc/common_audio/common_audio_sse2_gn",
-        "/third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn",
-        "/third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_avx2_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DIRS += [
-        "/third_party/libwebrtc/common_audio/common_audio_neon_c_gn",
-        "/third_party/libwebrtc/common_audio/common_audio_neon_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DIRS += [
-        "/third_party/libwebrtc/common_audio/common_audio_avx2_gn",
-        "/third_party/libwebrtc/common_audio/common_audio_sse2_gn",
-        "/third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn",
-        "/third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_avx2_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
+if CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "aarch64":
 
     DIRS += [
         "/third_party/libwebrtc/common_audio/common_audio_neon_c_gn",
         "/third_party/libwebrtc/common_audio/common_audio_neon_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/primitives_gn",
         "/third_party/libwebrtc/modules/portal/portal_gn",
         "/third_party/libwebrtc/third_party/libepoxy/libepoxy_gn"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
+if CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "mips32":
 
     DIRS += [
-        "/third_party/libwebrtc/common_audio/common_audio_neon_c_gn",
-        "/third_party/libwebrtc/common_audio/common_audio_neon_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/primitives_gn",
-        "/third_party/libwebrtc/modules/portal/portal_gn",
-        "/third_party/libwebrtc/rtc_base/system/asm_defines_gn",
-        "/third_party/libwebrtc/third_party/libepoxy/libepoxy_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "mips32":
-
-    DIRS += [
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/primitives_gn",
         "/third_party/libwebrtc/modules/portal/portal_gn",
         "/third_party/libwebrtc/third_party/libepoxy/libepoxy_gn"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "mips64":
+if CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "mips64":
 
     DIRS += [
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/primitives_gn",
         "/third_party/libwebrtc/modules/portal/portal_gn",
         "/third_party/libwebrtc/third_party/libepoxy/libepoxy_gn"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "x86":
 
     DIRS += [
         "/third_party/libwebrtc/common_audio/common_audio_avx2_gn",
@@ -655,13 +550,11 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
         "/third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn",
         "/third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_avx2_gn",
         "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/primitives_gn",
         "/third_party/libwebrtc/modules/portal/portal_gn",
         "/third_party/libwebrtc/third_party/libepoxy/libepoxy_gn"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "x86_64":
 
     DIRS += [
         "/third_party/libwebrtc/common_audio/common_audio_avx2_gn",
@@ -669,73 +562,6 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
         "/third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn",
         "/third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_avx2_gn",
         "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/primitives_gn",
         "/third_party/libwebrtc/modules/portal/portal_gn",
         "/third_party/libwebrtc/third_party/libepoxy/libepoxy_gn"
     ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DIRS += [
-        "/third_party/libwebrtc/common_audio/common_audio_neon_c_gn",
-        "/third_party/libwebrtc/common_audio/common_audio_neon_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DIRS += [
-        "/third_party/libwebrtc/common_audio/common_audio_avx2_gn",
-        "/third_party/libwebrtc/common_audio/common_audio_sse2_gn",
-        "/third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn",
-        "/third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_avx2_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "WINNT" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DIRS += [
-        "/third_party/libwebrtc/common_audio/common_audio_neon_c_gn",
-        "/third_party/libwebrtc/common_audio/common_audio_neon_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "WINNT" and CONFIG["TARGET_CPU"] == "x86":
-
-    DIRS += [
-        "/third_party/libwebrtc/common_audio/common_audio_avx2_gn",
-        "/third_party/libwebrtc/common_audio/common_audio_sse2_gn",
-        "/third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn",
-        "/third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_avx2_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn"
-    ]
-
-if CONFIG["OS_TARGET"] == "WINNT" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DIRS += [
-        "/third_party/libwebrtc/common_audio/common_audio_avx2_gn",
-        "/third_party/libwebrtc/common_audio/common_audio_sse2_gn",
-        "/third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn",
-        "/third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/vector_math_avx2_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn"
-    ]
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DIRS += [
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/primitives_gn"
-    ]
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "ppc64":
-
-    DIRS += [
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/primitives_gn"
-    ]
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "riscv64":
-
-    DIRS += [
-        "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
-        "/third_party/libwebrtc/modules/desktop_capture/primitives_gn"
-    ]
diff --git third_party/libwebrtc/net/dcsctp/common/internal_types_gn/moz.build third_party/libwebrtc/net/dcsctp/common/internal_types_gn/moz.build
index 6a5e4cfebe25..37b925ca7c54 100644
--- third_party/libwebrtc/net/dcsctp/common/internal_types_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/common/internal_types_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("internal_types_gn")
diff --git third_party/libwebrtc/net/dcsctp/common/math_gn/moz.build third_party/libwebrtc/net/dcsctp/common/math_gn/moz.build
index c3cb187e2306..a545273adb9f 100644
--- third_party/libwebrtc/net/dcsctp/common/math_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/common/math_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("math_gn")
diff --git third_party/libwebrtc/net/dcsctp/common/sequence_numbers_gn/moz.build third_party/libwebrtc/net/dcsctp/common/sequence_numbers_gn/moz.build
index c94cad55dd86..a3efde5199ae 100644
--- third_party/libwebrtc/net/dcsctp/common/sequence_numbers_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/common/sequence_numbers_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("sequence_numbers_gn")
diff --git third_party/libwebrtc/net/dcsctp/packet/bounded_io_gn/moz.build third_party/libwebrtc/net/dcsctp/packet/bounded_io_gn/moz.build
index b80cd74c33f8..2349cc2c46c5 100644
--- third_party/libwebrtc/net/dcsctp/packet/bounded_io_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/bounded_io_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("bounded_io_gn")
diff --git third_party/libwebrtc/net/dcsctp/packet/chunk_gn/moz.build third_party/libwebrtc/net/dcsctp/packet/chunk_gn/moz.build
index f7520a41a0ea..8a97ab477627 100644
--- third_party/libwebrtc/net/dcsctp/packet/chunk_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/chunk_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -61,186 +70,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("chunk_gn")
diff --git third_party/libwebrtc/net/dcsctp/packet/chunk_validators_gn/moz.build third_party/libwebrtc/net/dcsctp/packet/chunk_validators_gn/moz.build
index 0a06a330808a..b38a8e170736 100644
--- third_party/libwebrtc/net/dcsctp/packet/chunk_validators_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/chunk_validators_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("chunk_validators_gn")
diff --git third_party/libwebrtc/net/dcsctp/packet/crc32c_gn/moz.build third_party/libwebrtc/net/dcsctp/packet/crc32c_gn/moz.build
index 7babd4f00c8d..3544b8accf94 100644
--- third_party/libwebrtc/net/dcsctp/packet/crc32c_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/crc32c_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("crc32c_gn")
diff --git third_party/libwebrtc/net/dcsctp/packet/data_gn/moz.build third_party/libwebrtc/net/dcsctp/packet/data_gn/moz.build
index 56a67c706fa4..6921e2bc087f 100644
--- third_party/libwebrtc/net/dcsctp/packet/data_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/data_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("data_gn")
diff --git third_party/libwebrtc/net/dcsctp/packet/error_cause_gn/moz.build third_party/libwebrtc/net/dcsctp/packet/error_cause_gn/moz.build
index 04ca98c30fab..005f3ed8633a 100644
--- third_party/libwebrtc/net/dcsctp/packet/error_cause_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/error_cause_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -57,186 +66,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("error_cause_gn")
diff --git third_party/libwebrtc/net/dcsctp/packet/parameter_gn/moz.build third_party/libwebrtc/net/dcsctp/packet/parameter_gn/moz.build
index a1beb0f7c208..5a45e729c554 100644
--- third_party/libwebrtc/net/dcsctp/packet/parameter_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/parameter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -55,186 +64,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("parameter_gn")
diff --git third_party/libwebrtc/net/dcsctp/packet/sctp_packet_gn/moz.build third_party/libwebrtc/net/dcsctp/packet/sctp_packet_gn/moz.build
index 8940c608e991..2cba46b3bef8 100644
--- third_party/libwebrtc/net/dcsctp/packet/sctp_packet_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/sctp_packet_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("sctp_packet_gn")
diff --git third_party/libwebrtc/net/dcsctp/packet/tlv_trait_gn/moz.build third_party/libwebrtc/net/dcsctp/packet/tlv_trait_gn/moz.build
index 8ac207cfe1c5..3a4c616d2424 100644
--- third_party/libwebrtc/net/dcsctp/packet/tlv_trait_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/tlv_trait_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("tlv_trait_gn")
diff --git third_party/libwebrtc/net/dcsctp/public/factory_gn/moz.build third_party/libwebrtc/net/dcsctp/public/factory_gn/moz.build
index 2126af302d7b..25ce5477486d 100644
--- third_party/libwebrtc/net/dcsctp/public/factory_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/public/factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("factory_gn")
diff --git third_party/libwebrtc/net/dcsctp/public/socket_gn/moz.build third_party/libwebrtc/net/dcsctp/public/socket_gn/moz.build
index f65d94f80dca..a07bcaae7738 100644
--- third_party/libwebrtc/net/dcsctp/public/socket_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/public/socket_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("socket_gn")
diff --git third_party/libwebrtc/net/dcsctp/public/types_gn/moz.build third_party/libwebrtc/net/dcsctp/public/types_gn/moz.build
index 1b974d0796d6..738f80ce6793 100644
--- third_party/libwebrtc/net/dcsctp/public/types_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/public/types_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("types_gn")
diff --git third_party/libwebrtc/net/dcsctp/rx/data_tracker_gn/moz.build third_party/libwebrtc/net/dcsctp/rx/data_tracker_gn/moz.build
index 5276459a3feb..16efcdf3f232 100644
--- third_party/libwebrtc/net/dcsctp/rx/data_tracker_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/rx/data_tracker_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("data_tracker_gn")
diff --git third_party/libwebrtc/net/dcsctp/rx/interleaved_reassembly_streams_gn/moz.build third_party/libwebrtc/net/dcsctp/rx/interleaved_reassembly_streams_gn/moz.build
index 319c63c7eb91..e6d7a638ec76 100644
--- third_party/libwebrtc/net/dcsctp/rx/interleaved_reassembly_streams_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/rx/interleaved_reassembly_streams_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("interleaved_reassembly_streams_gn")
diff --git third_party/libwebrtc/net/dcsctp/rx/reassembly_queue_gn/moz.build third_party/libwebrtc/net/dcsctp/rx/reassembly_queue_gn/moz.build
index cdb84f7d102c..06f189fb7b51 100644
--- third_party/libwebrtc/net/dcsctp/rx/reassembly_queue_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/rx/reassembly_queue_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("reassembly_queue_gn")
diff --git third_party/libwebrtc/net/dcsctp/rx/reassembly_streams_gn/moz.build third_party/libwebrtc/net/dcsctp/rx/reassembly_streams_gn/moz.build
index 6c398b133ee0..fd95d137655b 100644
--- third_party/libwebrtc/net/dcsctp/rx/reassembly_streams_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/rx/reassembly_streams_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("reassembly_streams_gn")
diff --git third_party/libwebrtc/net/dcsctp/rx/traditional_reassembly_streams_gn/moz.build third_party/libwebrtc/net/dcsctp/rx/traditional_reassembly_streams_gn/moz.build
index dea3f1d04e9c..4da538440a2a 100644
--- third_party/libwebrtc/net/dcsctp/rx/traditional_reassembly_streams_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/rx/traditional_reassembly_streams_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("traditional_reassembly_streams_gn")
diff --git third_party/libwebrtc/net/dcsctp/socket/context_gn/moz.build third_party/libwebrtc/net/dcsctp/socket/context_gn/moz.build
index 1412fe4b2580..51f4925bb9e5 100644
--- third_party/libwebrtc/net/dcsctp/socket/context_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/socket/context_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("context_gn")
diff --git third_party/libwebrtc/net/dcsctp/socket/dcsctp_socket_gn/moz.build third_party/libwebrtc/net/dcsctp/socket/dcsctp_socket_gn/moz.build
index b5f74c59485f..fc81bd30b2b8 100644
--- third_party/libwebrtc/net/dcsctp/socket/dcsctp_socket_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/socket/dcsctp_socket_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,186 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("dcsctp_socket_gn")
diff --git third_party/libwebrtc/net/dcsctp/socket/heartbeat_handler_gn/moz.build third_party/libwebrtc/net/dcsctp/socket/heartbeat_handler_gn/moz.build
index 0a9c0ad00ea5..19c7c7c852fa 100644
--- third_party/libwebrtc/net/dcsctp/socket/heartbeat_handler_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/socket/heartbeat_handler_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("heartbeat_handler_gn")
diff --git third_party/libwebrtc/net/dcsctp/socket/packet_sender_gn/moz.build third_party/libwebrtc/net/dcsctp/socket/packet_sender_gn/moz.build
index ed127c2a2056..1bc00bd677ad 100644
--- third_party/libwebrtc/net/dcsctp/socket/packet_sender_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/socket/packet_sender_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("packet_sender_gn")
diff --git third_party/libwebrtc/net/dcsctp/socket/stream_reset_handler_gn/moz.build third_party/libwebrtc/net/dcsctp/socket/stream_reset_handler_gn/moz.build
index 49714f1804f3..fca2c697c710 100644
--- third_party/libwebrtc/net/dcsctp/socket/stream_reset_handler_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/socket/stream_reset_handler_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("stream_reset_handler_gn")
diff --git third_party/libwebrtc/net/dcsctp/socket/transmission_control_block_gn/moz.build third_party/libwebrtc/net/dcsctp/socket/transmission_control_block_gn/moz.build
index be93efb070fb..b780282e8e46 100644
--- third_party/libwebrtc/net/dcsctp/socket/transmission_control_block_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/socket/transmission_control_block_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("transmission_control_block_gn")
diff --git third_party/libwebrtc/net/dcsctp/timer/task_queue_timeout_gn/moz.build third_party/libwebrtc/net/dcsctp/timer/task_queue_timeout_gn/moz.build
index 19e9a8ae4cb0..ee7ab28bbb77 100644
--- third_party/libwebrtc/net/dcsctp/timer/task_queue_timeout_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/timer/task_queue_timeout_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("task_queue_timeout_gn")
diff --git third_party/libwebrtc/net/dcsctp/timer/timer_gn/moz.build third_party/libwebrtc/net/dcsctp/timer/timer_gn/moz.build
index fc21b96cb95e..92d3bad017da 100644
--- third_party/libwebrtc/net/dcsctp/timer/timer_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/timer/timer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("timer_gn")
diff --git third_party/libwebrtc/net/dcsctp/tx/outstanding_data_gn/moz.build third_party/libwebrtc/net/dcsctp/tx/outstanding_data_gn/moz.build
index d6f0efb0e95e..d9f2acafec11 100644
--- third_party/libwebrtc/net/dcsctp/tx/outstanding_data_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/tx/outstanding_data_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("outstanding_data_gn")
diff --git third_party/libwebrtc/net/dcsctp/tx/retransmission_error_counter_gn/moz.build third_party/libwebrtc/net/dcsctp/tx/retransmission_error_counter_gn/moz.build
index e4c78b2b27c0..f24cfb2e48ec 100644
--- third_party/libwebrtc/net/dcsctp/tx/retransmission_error_counter_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/tx/retransmission_error_counter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("retransmission_error_counter_gn")
diff --git third_party/libwebrtc/net/dcsctp/tx/retransmission_queue_gn/moz.build third_party/libwebrtc/net/dcsctp/tx/retransmission_queue_gn/moz.build
index 94099b89bbc9..d4eef73f4081 100644
--- third_party/libwebrtc/net/dcsctp/tx/retransmission_queue_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/tx/retransmission_queue_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("retransmission_queue_gn")
diff --git third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout_gn/moz.build third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout_gn/moz.build
index b3cc98e36fcb..7e95c8f18e3d 100644
--- third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("retransmission_timeout_gn")
diff --git third_party/libwebrtc/net/dcsctp/tx/rr_send_queue_gn/moz.build third_party/libwebrtc/net/dcsctp/tx/rr_send_queue_gn/moz.build
index 0930a4d36c9f..271a2fd7a9a7 100644
--- third_party/libwebrtc/net/dcsctp/tx/rr_send_queue_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/tx/rr_send_queue_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rr_send_queue_gn")
diff --git third_party/libwebrtc/net/dcsctp/tx/send_queue_gn/moz.build third_party/libwebrtc/net/dcsctp/tx/send_queue_gn/moz.build
index 53637eff6663..a227ea7ffca7 100644
--- third_party/libwebrtc/net/dcsctp/tx/send_queue_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/tx/send_queue_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("send_queue_gn")
diff --git third_party/libwebrtc/net/dcsctp/tx/stream_scheduler_gn/moz.build third_party/libwebrtc/net/dcsctp/tx/stream_scheduler_gn/moz.build
index 664394c22b67..0e1f5e52ab80 100644
--- third_party/libwebrtc/net/dcsctp/tx/stream_scheduler_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/tx/stream_scheduler_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("stream_scheduler_gn")
diff --git third_party/libwebrtc/rtc_base/async_dns_resolver_gn/moz.build third_party/libwebrtc/rtc_base/async_dns_resolver_gn/moz.build
index ebe2d31f76cb..4273164eb8ae 100644
--- third_party/libwebrtc/rtc_base/async_dns_resolver_gn/moz.build
+++ third_party/libwebrtc/rtc_base/async_dns_resolver_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,187 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("async_dns_resolver_gn")
diff --git third_party/libwebrtc/rtc_base/async_packet_socket_gn/moz.build third_party/libwebrtc/rtc_base/async_packet_socket_gn/moz.build
index 0739957773e6..99cb949dca52 100644
--- third_party/libwebrtc/rtc_base/async_packet_socket_gn/moz.build
+++ third_party/libwebrtc/rtc_base/async_packet_socket_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("async_packet_socket_gn")
diff --git third_party/libwebrtc/rtc_base/audio_format_to_string_gn/moz.build third_party/libwebrtc/rtc_base/audio_format_to_string_gn/moz.build
index dde6dc9d8144..be4e6cad1dbd 100644
--- third_party/libwebrtc/rtc_base/audio_format_to_string_gn/moz.build
+++ third_party/libwebrtc/rtc_base/audio_format_to_string_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("audio_format_to_string_gn")
diff --git third_party/libwebrtc/rtc_base/bit_buffer_gn/moz.build third_party/libwebrtc/rtc_base/bit_buffer_gn/moz.build
index ef6a31fb5e9b..67ba86b45fdf 100644
--- third_party/libwebrtc/rtc_base/bit_buffer_gn/moz.build
+++ third_party/libwebrtc/rtc_base/bit_buffer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("bit_buffer_gn")
diff --git third_party/libwebrtc/rtc_base/bitrate_tracker_gn/moz.build third_party/libwebrtc/rtc_base/bitrate_tracker_gn/moz.build
index e98692d2e7b7..45ab9ef5afd1 100644
--- third_party/libwebrtc/rtc_base/bitrate_tracker_gn/moz.build
+++ third_party/libwebrtc/rtc_base/bitrate_tracker_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("bitrate_tracker_gn")
diff --git third_party/libwebrtc/rtc_base/bitstream_reader_gn/moz.build third_party/libwebrtc/rtc_base/bitstream_reader_gn/moz.build
index 41bb6e4e0ee4..c8612822886c 100644
--- third_party/libwebrtc/rtc_base/bitstream_reader_gn/moz.build
+++ third_party/libwebrtc/rtc_base/bitstream_reader_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("bitstream_reader_gn")
diff --git third_party/libwebrtc/rtc_base/buffer_gn/moz.build third_party/libwebrtc/rtc_base/buffer_gn/moz.build
index 896456d6ec99..534605ccf4e2 100644
--- third_party/libwebrtc/rtc_base/buffer_gn/moz.build
+++ third_party/libwebrtc/rtc_base/buffer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("buffer_gn")
diff --git third_party/libwebrtc/rtc_base/byte_buffer_gn/moz.build third_party/libwebrtc/rtc_base/byte_buffer_gn/moz.build
index efa39af67ca2..4fbf51d84dd6 100644
--- third_party/libwebrtc/rtc_base/byte_buffer_gn/moz.build
+++ third_party/libwebrtc/rtc_base/byte_buffer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("byte_buffer_gn")
diff --git third_party/libwebrtc/rtc_base/byte_order_gn/moz.build third_party/libwebrtc/rtc_base/byte_order_gn/moz.build
index ce685d4814d2..65ab76218c6c 100644
--- third_party/libwebrtc/rtc_base/byte_order_gn/moz.build
+++ third_party/libwebrtc/rtc_base/byte_order_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("byte_order_gn")
diff --git third_party/libwebrtc/rtc_base/checks_gn/moz.build third_party/libwebrtc/rtc_base/checks_gn/moz.build
index 1f38f2ca7a4f..2e0f0e8b7744 100644
--- third_party/libwebrtc/rtc_base/checks_gn/moz.build
+++ third_party/libwebrtc/rtc_base/checks_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("checks_gn")
diff --git third_party/libwebrtc/rtc_base/compile_assert_c_gn/moz.build third_party/libwebrtc/rtc_base/compile_assert_c_gn/moz.build
index 154848b920fa..09fca9233e44 100644
--- third_party/libwebrtc/rtc_base/compile_assert_c_gn/moz.build
+++ third_party/libwebrtc/rtc_base/compile_assert_c_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("compile_assert_c_gn")
diff --git third_party/libwebrtc/rtc_base/containers/flat_containers_internal_gn/moz.build third_party/libwebrtc/rtc_base/containers/flat_containers_internal_gn/moz.build
index d5f7393960b9..0108ed9d35e6 100644
--- third_party/libwebrtc/rtc_base/containers/flat_containers_internal_gn/moz.build
+++ third_party/libwebrtc/rtc_base/containers/flat_containers_internal_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("flat_containers_internal_gn")
diff --git third_party/libwebrtc/rtc_base/containers/flat_map_gn/moz.build third_party/libwebrtc/rtc_base/containers/flat_map_gn/moz.build
index 638358d79d52..c890542ae1f6 100644
--- third_party/libwebrtc/rtc_base/containers/flat_map_gn/moz.build
+++ third_party/libwebrtc/rtc_base/containers/flat_map_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("flat_map_gn")
diff --git third_party/libwebrtc/rtc_base/containers/flat_set_gn/moz.build third_party/libwebrtc/rtc_base/containers/flat_set_gn/moz.build
index 92883483f5fd..006cc6bb1523 100644
--- third_party/libwebrtc/rtc_base/containers/flat_set_gn/moz.build
+++ third_party/libwebrtc/rtc_base/containers/flat_set_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("flat_set_gn")
diff --git third_party/libwebrtc/rtc_base/copy_on_write_buffer_gn/moz.build third_party/libwebrtc/rtc_base/copy_on_write_buffer_gn/moz.build
index d46afc84b9ae..2b9429eb7b3a 100644
--- third_party/libwebrtc/rtc_base/copy_on_write_buffer_gn/moz.build
+++ third_party/libwebrtc/rtc_base/copy_on_write_buffer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("copy_on_write_buffer_gn")
diff --git third_party/libwebrtc/rtc_base/criticalsection_gn/moz.build third_party/libwebrtc/rtc_base/criticalsection_gn/moz.build
index d8537d397409..e797c80aed74 100644
--- third_party/libwebrtc/rtc_base/criticalsection_gn/moz.build
+++ third_party/libwebrtc/rtc_base/criticalsection_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("criticalsection_gn")
diff --git third_party/libwebrtc/rtc_base/divide_round_gn/moz.build third_party/libwebrtc/rtc_base/divide_round_gn/moz.build
index d46350e65b1f..862afa6e80cb 100644
--- third_party/libwebrtc/rtc_base/divide_round_gn/moz.build
+++ third_party/libwebrtc/rtc_base/divide_round_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("divide_round_gn")
diff --git third_party/libwebrtc/rtc_base/dscp_gn/moz.build third_party/libwebrtc/rtc_base/dscp_gn/moz.build
index fd796dcc7283..a69f3be68a5a 100644
--- third_party/libwebrtc/rtc_base/dscp_gn/moz.build
+++ third_party/libwebrtc/rtc_base/dscp_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("dscp_gn")
diff --git third_party/libwebrtc/rtc_base/event_tracer_gn/moz.build third_party/libwebrtc/rtc_base/event_tracer_gn/moz.build
index 89739a31462a..caa13bc3d03f 100644
--- third_party/libwebrtc/rtc_base/event_tracer_gn/moz.build
+++ third_party/libwebrtc/rtc_base/event_tracer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,186 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("event_tracer_gn")
diff --git third_party/libwebrtc/rtc_base/experiments/alr_experiment_gn/moz.build third_party/libwebrtc/rtc_base/experiments/alr_experiment_gn/moz.build
index db73007e0648..3b48de94a7cf 100644
--- third_party/libwebrtc/rtc_base/experiments/alr_experiment_gn/moz.build
+++ third_party/libwebrtc/rtc_base/experiments/alr_experiment_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("alr_experiment_gn")
diff --git third_party/libwebrtc/rtc_base/experiments/balanced_degradation_settings_gn/moz.build third_party/libwebrtc/rtc_base/experiments/balanced_degradation_settings_gn/moz.build
index a68f41b455b7..1e18365e267f 100644
--- third_party/libwebrtc/rtc_base/experiments/balanced_degradation_settings_gn/moz.build
+++ third_party/libwebrtc/rtc_base/experiments/balanced_degradation_settings_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("balanced_degradation_settings_gn")
diff --git third_party/libwebrtc/rtc_base/experiments/encoder_info_settings_gn/moz.build third_party/libwebrtc/rtc_base/experiments/encoder_info_settings_gn/moz.build
index 76246fa6ff03..3e75b9cd7207 100644
--- third_party/libwebrtc/rtc_base/experiments/encoder_info_settings_gn/moz.build
+++ third_party/libwebrtc/rtc_base/experiments/encoder_info_settings_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("encoder_info_settings_gn")
diff --git third_party/libwebrtc/rtc_base/experiments/field_trial_parser_gn/moz.build third_party/libwebrtc/rtc_base/experiments/field_trial_parser_gn/moz.build
index e55be35e9b1a..7058a6b0e3c6 100644
--- third_party/libwebrtc/rtc_base/experiments/field_trial_parser_gn/moz.build
+++ third_party/libwebrtc/rtc_base/experiments/field_trial_parser_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,186 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("field_trial_parser_gn")
diff --git third_party/libwebrtc/rtc_base/experiments/keyframe_interval_settings_experiment_gn/moz.build third_party/libwebrtc/rtc_base/experiments/keyframe_interval_settings_experiment_gn/moz.build
index e5b723ef37b6..a02341d3de17 100644
--- third_party/libwebrtc/rtc_base/experiments/keyframe_interval_settings_experiment_gn/moz.build
+++ third_party/libwebrtc/rtc_base/experiments/keyframe_interval_settings_experiment_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("keyframe_interval_settings_experiment_gn")
diff --git third_party/libwebrtc/rtc_base/experiments/min_video_bitrate_experiment_gn/moz.build third_party/libwebrtc/rtc_base/experiments/min_video_bitrate_experiment_gn/moz.build
index e8863d79f0bb..220d29302b62 100644
--- third_party/libwebrtc/rtc_base/experiments/min_video_bitrate_experiment_gn/moz.build
+++ third_party/libwebrtc/rtc_base/experiments/min_video_bitrate_experiment_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("min_video_bitrate_experiment_gn")
diff --git third_party/libwebrtc/rtc_base/experiments/normalize_simulcast_size_experiment_gn/moz.build third_party/libwebrtc/rtc_base/experiments/normalize_simulcast_size_experiment_gn/moz.build
index 50cc28070487..9c8d4710941c 100644
--- third_party/libwebrtc/rtc_base/experiments/normalize_simulcast_size_experiment_gn/moz.build
+++ third_party/libwebrtc/rtc_base/experiments/normalize_simulcast_size_experiment_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("normalize_simulcast_size_experiment_gn")
diff --git third_party/libwebrtc/rtc_base/experiments/quality_scaler_settings_gn/moz.build third_party/libwebrtc/rtc_base/experiments/quality_scaler_settings_gn/moz.build
index 7700987d9727..fed428b40312 100644
--- third_party/libwebrtc/rtc_base/experiments/quality_scaler_settings_gn/moz.build
+++ third_party/libwebrtc/rtc_base/experiments/quality_scaler_settings_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("quality_scaler_settings_gn")
diff --git third_party/libwebrtc/rtc_base/experiments/quality_scaling_experiment_gn/moz.build third_party/libwebrtc/rtc_base/experiments/quality_scaling_experiment_gn/moz.build
index cdfadf1b3a44..91fa15309a19 100644
--- third_party/libwebrtc/rtc_base/experiments/quality_scaling_experiment_gn/moz.build
+++ third_party/libwebrtc/rtc_base/experiments/quality_scaling_experiment_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("quality_scaling_experiment_gn")
diff --git third_party/libwebrtc/rtc_base/experiments/rate_control_settings_gn/moz.build third_party/libwebrtc/rtc_base/experiments/rate_control_settings_gn/moz.build
index d64269a76871..835d78fa3a6c 100644
--- third_party/libwebrtc/rtc_base/experiments/rate_control_settings_gn/moz.build
+++ third_party/libwebrtc/rtc_base/experiments/rate_control_settings_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rate_control_settings_gn")
diff --git third_party/libwebrtc/rtc_base/experiments/stable_target_rate_experiment_gn/moz.build third_party/libwebrtc/rtc_base/experiments/stable_target_rate_experiment_gn/moz.build
index 708a893a10ad..8620aa9d4bd8 100644
--- third_party/libwebrtc/rtc_base/experiments/stable_target_rate_experiment_gn/moz.build
+++ third_party/libwebrtc/rtc_base/experiments/stable_target_rate_experiment_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("stable_target_rate_experiment_gn")
diff --git third_party/libwebrtc/rtc_base/frequency_tracker_gn/moz.build third_party/libwebrtc/rtc_base/frequency_tracker_gn/moz.build
index 1a6ff46f9057..286569c90089 100644
--- third_party/libwebrtc/rtc_base/frequency_tracker_gn/moz.build
+++ third_party/libwebrtc/rtc_base/frequency_tracker_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frequency_tracker_gn")
diff --git third_party/libwebrtc/rtc_base/gtest_prod_gn/moz.build third_party/libwebrtc/rtc_base/gtest_prod_gn/moz.build
index 493edecc9a2c..fd41ef0a21f7 100644
--- third_party/libwebrtc/rtc_base/gtest_prod_gn/moz.build
+++ third_party/libwebrtc/rtc_base/gtest_prod_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("gtest_prod_gn")
diff --git third_party/libwebrtc/rtc_base/histogram_percentile_counter_gn/moz.build third_party/libwebrtc/rtc_base/histogram_percentile_counter_gn/moz.build
index 51e370a925b2..17a7725eb3c0 100644
--- third_party/libwebrtc/rtc_base/histogram_percentile_counter_gn/moz.build
+++ third_party/libwebrtc/rtc_base/histogram_percentile_counter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("histogram_percentile_counter_gn")
diff --git third_party/libwebrtc/rtc_base/ifaddrs_android_gn/moz.build third_party/libwebrtc/rtc_base/ifaddrs_android_gn/moz.build
deleted file mode 100644
index c4e0aad848a9..000000000000
--- third_party/libwebrtc/rtc_base/ifaddrs_android_gn/moz.build
+++ /dev/null
@@ -1,95 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["ANDROID"] = True
-DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-DEFINES["HAVE_SYS_UIO_H"] = True
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["WEBRTC_ANDROID"] = True
-DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_LINUX"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_POSIX"] = True
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["_GNU_SOURCE"] = True
-DEFINES["__STDC_CONSTANT_MACROS"] = True
-DEFINES["__STDC_FORMAT_MACROS"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/tools/profiler/public"
-]
-
-OS_LIBS += [
-    "GLESv2",
-    "log"
-]
-
-UNIFIED_SOURCES += [
-    "/third_party/libwebrtc/rtc_base/ifaddrs_android.cc"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["TARGET_CPU"] == "x86":
-
-    CXXFLAGS += [
-        "-msse2"
-    ]
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("ifaddrs_android_gn")
diff --git third_party/libwebrtc/rtc_base/ignore_wundef_gn/moz.build third_party/libwebrtc/rtc_base/ignore_wundef_gn/moz.build
index 01c10d595e8b..0b3ff10cc360 100644
--- third_party/libwebrtc/rtc_base/ignore_wundef_gn/moz.build
+++ third_party/libwebrtc/rtc_base/ignore_wundef_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("ignore_wundef_gn")
diff --git third_party/libwebrtc/rtc_base/ip_address_gn/moz.build third_party/libwebrtc/rtc_base/ip_address_gn/moz.build
index d949fcc26e8d..7d64e4ef330c 100644
--- third_party/libwebrtc/rtc_base/ip_address_gn/moz.build
+++ third_party/libwebrtc/rtc_base/ip_address_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("ip_address_gn")
diff --git third_party/libwebrtc/rtc_base/logging_gn/moz.build third_party/libwebrtc/rtc_base/logging_gn/moz.build
index 2dfe0c2fec46..e391440561dd 100644
--- third_party/libwebrtc/rtc_base/logging_gn/moz.build
+++ third_party/libwebrtc/rtc_base/logging_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
 DEFINES["WEBRTC_APM_DEBUG_DUMP"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,186 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("logging_gn")
diff --git third_party/libwebrtc/rtc_base/macromagic_gn/moz.build third_party/libwebrtc/rtc_base/macromagic_gn/moz.build
index 390b189b0db6..4433ee4394b0 100644
--- third_party/libwebrtc/rtc_base/macromagic_gn/moz.build
+++ third_party/libwebrtc/rtc_base/macromagic_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("macromagic_gn")
diff --git third_party/libwebrtc/rtc_base/memory/aligned_malloc_gn/moz.build third_party/libwebrtc/rtc_base/memory/aligned_malloc_gn/moz.build
index 0a65ef231ef4..4c8711cb2921 100644
--- third_party/libwebrtc/rtc_base/memory/aligned_malloc_gn/moz.build
+++ third_party/libwebrtc/rtc_base/memory/aligned_malloc_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("aligned_malloc_gn")
diff --git third_party/libwebrtc/rtc_base/mod_ops_gn/moz.build third_party/libwebrtc/rtc_base/mod_ops_gn/moz.build
index 61e454135d16..baf4e8a72632 100644
--- third_party/libwebrtc/rtc_base/mod_ops_gn/moz.build
+++ third_party/libwebrtc/rtc_base/mod_ops_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("mod_ops_gn")
diff --git third_party/libwebrtc/rtc_base/moving_max_counter_gn/moz.build third_party/libwebrtc/rtc_base/moving_max_counter_gn/moz.build
index ec440ef76608..97d948e88c49 100644
--- third_party/libwebrtc/rtc_base/moving_max_counter_gn/moz.build
+++ third_party/libwebrtc/rtc_base/moving_max_counter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("moving_max_counter_gn")
diff --git third_party/libwebrtc/rtc_base/net_helpers_gn/moz.build third_party/libwebrtc/rtc_base/net_helpers_gn/moz.build
index 68e7540a5cc6..e2763aae13c2 100644
--- third_party/libwebrtc/rtc_base/net_helpers_gn/moz.build
+++ third_party/libwebrtc/rtc_base/net_helpers_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("net_helpers_gn")
diff --git third_party/libwebrtc/rtc_base/network/ecn_marking_gn/moz.build third_party/libwebrtc/rtc_base/network/ecn_marking_gn/moz.build
index 598652874c2f..b08c4ae86174 100644
--- third_party/libwebrtc/rtc_base/network/ecn_marking_gn/moz.build
+++ third_party/libwebrtc/rtc_base/network/ecn_marking_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("ecn_marking_gn")
diff --git third_party/libwebrtc/rtc_base/network/sent_packet_gn/moz.build third_party/libwebrtc/rtc_base/network/sent_packet_gn/moz.build
index c285d04f5def..93432583b4da 100644
--- third_party/libwebrtc/rtc_base/network/sent_packet_gn/moz.build
+++ third_party/libwebrtc/rtc_base/network/sent_packet_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("sent_packet_gn")
diff --git third_party/libwebrtc/rtc_base/network_constants_gn/moz.build third_party/libwebrtc/rtc_base/network_constants_gn/moz.build
index 3b41f5bba9f9..f95b171fdf32 100644
--- third_party/libwebrtc/rtc_base/network_constants_gn/moz.build
+++ third_party/libwebrtc/rtc_base/network_constants_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("network_constants_gn")
diff --git third_party/libwebrtc/rtc_base/network_route_gn/moz.build third_party/libwebrtc/rtc_base/network_route_gn/moz.build
index ed2d7204f43b..5f59b36411dd 100644
--- third_party/libwebrtc/rtc_base/network_route_gn/moz.build
+++ third_party/libwebrtc/rtc_base/network_route_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("network_route_gn")
diff --git third_party/libwebrtc/rtc_base/null_socket_server_gn/moz.build third_party/libwebrtc/rtc_base/null_socket_server_gn/moz.build
index d129b17f1194..cbd1b431f6de 100644
--- third_party/libwebrtc/rtc_base/null_socket_server_gn/moz.build
+++ third_party/libwebrtc/rtc_base/null_socket_server_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,187 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("null_socket_server_gn")
diff --git third_party/libwebrtc/rtc_base/one_time_event_gn/moz.build third_party/libwebrtc/rtc_base/one_time_event_gn/moz.build
index 348ef02526a2..74729015b2fb 100644
--- third_party/libwebrtc/rtc_base/one_time_event_gn/moz.build
+++ third_party/libwebrtc/rtc_base/one_time_event_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("one_time_event_gn")
diff --git third_party/libwebrtc/rtc_base/platform_thread_gn/moz.build third_party/libwebrtc/rtc_base/platform_thread_gn/moz.build
index 9ad40b93add5..07001c7343ac 100644
--- third_party/libwebrtc/rtc_base/platform_thread_gn/moz.build
+++ third_party/libwebrtc/rtc_base/platform_thread_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("platform_thread_gn")
diff --git third_party/libwebrtc/rtc_base/platform_thread_types_gn/moz.build third_party/libwebrtc/rtc_base/platform_thread_types_gn/moz.build
index 0d132b2957f2..68d9e334d850 100644
--- third_party/libwebrtc/rtc_base/platform_thread_types_gn/moz.build
+++ third_party/libwebrtc/rtc_base/platform_thread_types_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("platform_thread_types_gn")
diff --git third_party/libwebrtc/rtc_base/protobuf_utils_gn/moz.build third_party/libwebrtc/rtc_base/protobuf_utils_gn/moz.build
index be3e5d165cb6..98b13de31ec0 100644
--- third_party/libwebrtc/rtc_base/protobuf_utils_gn/moz.build
+++ third_party/libwebrtc/rtc_base/protobuf_utils_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("protobuf_utils_gn")
diff --git third_party/libwebrtc/rtc_base/race_checker_gn/moz.build third_party/libwebrtc/rtc_base/race_checker_gn/moz.build
index 941e32ae1829..dff9cadb77f1 100644
--- third_party/libwebrtc/rtc_base/race_checker_gn/moz.build
+++ third_party/libwebrtc/rtc_base/race_checker_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("race_checker_gn")
diff --git third_party/libwebrtc/rtc_base/random_gn/moz.build third_party/libwebrtc/rtc_base/random_gn/moz.build
index 9a81a9569ef6..e6faef7d99c2 100644
--- third_party/libwebrtc/rtc_base/random_gn/moz.build
+++ third_party/libwebrtc/rtc_base/random_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("random_gn")
diff --git third_party/libwebrtc/rtc_base/rate_limiter_gn/moz.build third_party/libwebrtc/rtc_base/rate_limiter_gn/moz.build
index db17875a1c66..7a2df04c78e3 100644
--- third_party/libwebrtc/rtc_base/rate_limiter_gn/moz.build
+++ third_party/libwebrtc/rtc_base/rate_limiter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rate_limiter_gn")
diff --git third_party/libwebrtc/rtc_base/rate_statistics_gn/moz.build third_party/libwebrtc/rtc_base/rate_statistics_gn/moz.build
index 6bb56ffbd174..d42bea3f3af5 100644
--- third_party/libwebrtc/rtc_base/rate_statistics_gn/moz.build
+++ third_party/libwebrtc/rtc_base/rate_statistics_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rate_statistics_gn")
diff --git third_party/libwebrtc/rtc_base/rate_tracker_gn/moz.build third_party/libwebrtc/rtc_base/rate_tracker_gn/moz.build
index f9532edf05b6..39cdb435615a 100644
--- third_party/libwebrtc/rtc_base/rate_tracker_gn/moz.build
+++ third_party/libwebrtc/rtc_base/rate_tracker_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rate_tracker_gn")
diff --git third_party/libwebrtc/rtc_base/refcount_gn/moz.build third_party/libwebrtc/rtc_base/refcount_gn/moz.build
index 3de678e52f56..dffea650acbd 100644
--- third_party/libwebrtc/rtc_base/refcount_gn/moz.build
+++ third_party/libwebrtc/rtc_base/refcount_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("refcount_gn")
diff --git third_party/libwebrtc/rtc_base/rolling_accumulator_gn/moz.build third_party/libwebrtc/rtc_base/rolling_accumulator_gn/moz.build
index 01650e82652c..eb46e9e0940e 100644
--- third_party/libwebrtc/rtc_base/rolling_accumulator_gn/moz.build
+++ third_party/libwebrtc/rtc_base/rolling_accumulator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rolling_accumulator_gn")
diff --git third_party/libwebrtc/rtc_base/rtc_event_gn/moz.build third_party/libwebrtc/rtc_base/rtc_event_gn/moz.build
index 57d72e2c1e9f..2a64b57441ec 100644
--- third_party/libwebrtc/rtc_base/rtc_event_gn/moz.build
+++ third_party/libwebrtc/rtc_base/rtc_event_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_event_gn")
diff --git third_party/libwebrtc/rtc_base/rtc_numerics_gn/moz.build third_party/libwebrtc/rtc_base/rtc_numerics_gn/moz.build
index e5f133fc9924..63aa82161c35 100644
--- third_party/libwebrtc/rtc_base/rtc_numerics_gn/moz.build
+++ third_party/libwebrtc/rtc_base/rtc_numerics_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,179 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rtc_numerics_gn")
diff --git third_party/libwebrtc/rtc_base/safe_compare_gn/moz.build third_party/libwebrtc/rtc_base/safe_compare_gn/moz.build
index a64091f2b704..b5b71363445a 100644
--- third_party/libwebrtc/rtc_base/safe_compare_gn/moz.build
+++ third_party/libwebrtc/rtc_base/safe_compare_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("safe_compare_gn")
diff --git third_party/libwebrtc/rtc_base/safe_conversions_gn/moz.build third_party/libwebrtc/rtc_base/safe_conversions_gn/moz.build
index 3041610af6d3..059c8cf3092a 100644
--- third_party/libwebrtc/rtc_base/safe_conversions_gn/moz.build
+++ third_party/libwebrtc/rtc_base/safe_conversions_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("safe_conversions_gn")
diff --git third_party/libwebrtc/rtc_base/safe_minmax_gn/moz.build third_party/libwebrtc/rtc_base/safe_minmax_gn/moz.build
index 58903e9a4e63..2f50afc26237 100644
--- third_party/libwebrtc/rtc_base/safe_minmax_gn/moz.build
+++ third_party/libwebrtc/rtc_base/safe_minmax_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("safe_minmax_gn")
diff --git third_party/libwebrtc/rtc_base/sample_counter_gn/moz.build third_party/libwebrtc/rtc_base/sample_counter_gn/moz.build
index 8ee16d80ed85..c9bc739d62e9 100644
--- third_party/libwebrtc/rtc_base/sample_counter_gn/moz.build
+++ third_party/libwebrtc/rtc_base/sample_counter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("sample_counter_gn")
diff --git third_party/libwebrtc/rtc_base/sanitizer_gn/moz.build third_party/libwebrtc/rtc_base/sanitizer_gn/moz.build
index cbd346e5dc21..980b9765b1de 100644
--- third_party/libwebrtc/rtc_base/sanitizer_gn/moz.build
+++ third_party/libwebrtc/rtc_base/sanitizer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("sanitizer_gn")
diff --git third_party/libwebrtc/rtc_base/socket_address_gn/moz.build third_party/libwebrtc/rtc_base/socket_address_gn/moz.build
index 7dfe5738c998..91e90e92a460 100644
--- third_party/libwebrtc/rtc_base/socket_address_gn/moz.build
+++ third_party/libwebrtc/rtc_base/socket_address_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,187 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("socket_address_gn")
diff --git third_party/libwebrtc/rtc_base/socket_factory_gn/moz.build third_party/libwebrtc/rtc_base/socket_factory_gn/moz.build
index 5c4cf0261e1a..4de54ef5649f 100644
--- third_party/libwebrtc/rtc_base/socket_factory_gn/moz.build
+++ third_party/libwebrtc/rtc_base/socket_factory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,120 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -163,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("socket_factory_gn")
diff --git third_party/libwebrtc/rtc_base/socket_gn/moz.build third_party/libwebrtc/rtc_base/socket_gn/moz.build
index 43f98b9758bf..27b46ae4f612 100644
--- third_party/libwebrtc/rtc_base/socket_gn/moz.build
+++ third_party/libwebrtc/rtc_base/socket_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,187 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("socket_gn")
diff --git third_party/libwebrtc/rtc_base/socket_server_gn/moz.build third_party/libwebrtc/rtc_base/socket_server_gn/moz.build
index d24756b4d615..5a576332fb94 100644
--- third_party/libwebrtc/rtc_base/socket_server_gn/moz.build
+++ third_party/libwebrtc/rtc_base/socket_server_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,120 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -163,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("socket_server_gn")
diff --git third_party/libwebrtc/rtc_base/ssl_adapter_gn/moz.build third_party/libwebrtc/rtc_base/ssl_adapter_gn/moz.build
index 7df6c9be0d52..37f417671c69 100644
--- third_party/libwebrtc/rtc_base/ssl_adapter_gn/moz.build
+++ third_party/libwebrtc/rtc_base/ssl_adapter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("ssl_adapter_gn")
diff --git third_party/libwebrtc/rtc_base/ssl_gn/moz.build third_party/libwebrtc/rtc_base/ssl_gn/moz.build
index 3b316011d903..9f73c2a4952a 100644
--- third_party/libwebrtc/rtc_base/ssl_gn/moz.build
+++ third_party/libwebrtc/rtc_base/ssl_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("ssl_gn")
diff --git third_party/libwebrtc/rtc_base/stringutils_gn/moz.build third_party/libwebrtc/rtc_base/stringutils_gn/moz.build
index 8968548bc44d..6ae58958a750 100644
--- third_party/libwebrtc/rtc_base/stringutils_gn/moz.build
+++ third_party/libwebrtc/rtc_base/stringutils_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -48,179 +57,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("stringutils_gn")
diff --git third_party/libwebrtc/rtc_base/strong_alias_gn/moz.build third_party/libwebrtc/rtc_base/strong_alias_gn/moz.build
index 3ca55f387657..3578dca2f457 100644
--- third_party/libwebrtc/rtc_base/strong_alias_gn/moz.build
+++ third_party/libwebrtc/rtc_base/strong_alias_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("strong_alias_gn")
diff --git third_party/libwebrtc/rtc_base/swap_queue_gn/moz.build third_party/libwebrtc/rtc_base/swap_queue_gn/moz.build
index 84aa26f7defe..3b411438cbea 100644
--- third_party/libwebrtc/rtc_base/swap_queue_gn/moz.build
+++ third_party/libwebrtc/rtc_base/swap_queue_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("swap_queue_gn")
diff --git third_party/libwebrtc/rtc_base/synchronization/mutex_gn/moz.build third_party/libwebrtc/rtc_base/synchronization/mutex_gn/moz.build
index 9ce9d8492bdc..97ba7f1f28a4 100644
--- third_party/libwebrtc/rtc_base/synchronization/mutex_gn/moz.build
+++ third_party/libwebrtc/rtc_base/synchronization/mutex_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("mutex_gn")
diff --git third_party/libwebrtc/rtc_base/synchronization/sequence_checker_internal_gn/moz.build third_party/libwebrtc/rtc_base/synchronization/sequence_checker_internal_gn/moz.build
index 3f32dcb1a7a0..2b47834fa63c 100644
--- third_party/libwebrtc/rtc_base/synchronization/sequence_checker_internal_gn/moz.build
+++ third_party/libwebrtc/rtc_base/synchronization/sequence_checker_internal_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("sequence_checker_internal_gn")
diff --git third_party/libwebrtc/rtc_base/synchronization/yield_gn/moz.build third_party/libwebrtc/rtc_base/synchronization/yield_gn/moz.build
index 3e512b9b5730..c09f2aea4cb5 100644
--- third_party/libwebrtc/rtc_base/synchronization/yield_gn/moz.build
+++ third_party/libwebrtc/rtc_base/synchronization/yield_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("yield_gn")
diff --git third_party/libwebrtc/rtc_base/synchronization/yield_policy_gn/moz.build third_party/libwebrtc/rtc_base/synchronization/yield_policy_gn/moz.build
index 3f1dd4f9247c..7269d51420de 100644
--- third_party/libwebrtc/rtc_base/synchronization/yield_policy_gn/moz.build
+++ third_party/libwebrtc/rtc_base/synchronization/yield_policy_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("yield_policy_gn")
diff --git third_party/libwebrtc/rtc_base/system/arch_gn/moz.build third_party/libwebrtc/rtc_base/system/arch_gn/moz.build
index 4deae9759dba..e7eb27834aca 100644
--- third_party/libwebrtc/rtc_base/system/arch_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/arch_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("arch_gn")
diff --git third_party/libwebrtc/rtc_base/system/asm_defines_gn/moz.build third_party/libwebrtc/rtc_base/system/asm_defines_gn/moz.build
deleted file mode 100644
index 0a5db7e1cf27..000000000000
--- third_party/libwebrtc/rtc_base/system/asm_defines_gn/moz.build
+++ /dev/null
@@ -1,80 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["WEBRTC_ARCH_ARM"] = True
-DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_HAS_NEON"] = True
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_LINUX"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_POSIX"] = True
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["_GNU_SOURCE"] = True
-DEFINES["__STDC_CONSTANT_MACROS"] = True
-DEFINES["__STDC_FORMAT_MACROS"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/tools/profiler/public"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-Library("asm_defines_gn")
diff --git third_party/libwebrtc/rtc_base/system/cocoa_threading_gn/moz.build third_party/libwebrtc/rtc_base/system/cocoa_threading_gn/moz.build
deleted file mode 100644
index b151034cb93e..000000000000
--- third_party/libwebrtc/rtc_base/system/cocoa_threading_gn/moz.build
+++ /dev/null
@@ -1,68 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-CMMFLAGS += [
-    "-fobjc-arc"
-]
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MAC"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_POSIX"] = True
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-DEFINES["__STDC_CONSTANT_MACROS"] = True
-DEFINES["__STDC_FORMAT_MACROS"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/tools/profiler/public"
-]
-
-UNIFIED_SOURCES += [
-    "/third_party/libwebrtc/rtc_base/system/cocoa_threading.mm"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("cocoa_threading_gn")
diff --git third_party/libwebrtc/rtc_base/system/file_wrapper_gn/moz.build third_party/libwebrtc/rtc_base/system/file_wrapper_gn/moz.build
index e0f7d039805f..d46c159135e3 100644
--- third_party/libwebrtc/rtc_base/system/file_wrapper_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/file_wrapper_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("file_wrapper_gn")
diff --git third_party/libwebrtc/rtc_base/system/gcd_helpers_gn/moz.build third_party/libwebrtc/rtc_base/system/gcd_helpers_gn/moz.build
deleted file mode 100644
index 20d7ec25d78c..000000000000
--- third_party/libwebrtc/rtc_base/system/gcd_helpers_gn/moz.build
+++ /dev/null
@@ -1,68 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-CMFLAGS += [
-    "-fobjc-arc"
-]
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MAC"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_POSIX"] = True
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-DEFINES["__STDC_CONSTANT_MACROS"] = True
-DEFINES["__STDC_FORMAT_MACROS"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/tools/profiler/public"
-]
-
-UNIFIED_SOURCES += [
-    "/third_party/libwebrtc/rtc_base/system/gcd_helpers.m"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("gcd_helpers_gn")
diff --git third_party/libwebrtc/rtc_base/system/ignore_warnings_gn/moz.build third_party/libwebrtc/rtc_base/system/ignore_warnings_gn/moz.build
index 6f3525b99ada..c14467e95dc7 100644
--- third_party/libwebrtc/rtc_base/system/ignore_warnings_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/ignore_warnings_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("ignore_warnings_gn")
diff --git third_party/libwebrtc/rtc_base/system/inline_gn/moz.build third_party/libwebrtc/rtc_base/system/inline_gn/moz.build
index 2cb5fb8f52a9..1e8684bd302d 100644
--- third_party/libwebrtc/rtc_base/system/inline_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/inline_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("inline_gn")
diff --git third_party/libwebrtc/rtc_base/system/no_unique_address_gn/moz.build third_party/libwebrtc/rtc_base/system/no_unique_address_gn/moz.build
index e92150e1d709..da652288e143 100644
--- third_party/libwebrtc/rtc_base/system/no_unique_address_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/no_unique_address_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("no_unique_address_gn")
diff --git third_party/libwebrtc/rtc_base/system/rtc_export_gn/moz.build third_party/libwebrtc/rtc_base/system/rtc_export_gn/moz.build
index 8a7929181db2..8a2c396a6f97 100644
--- third_party/libwebrtc/rtc_base/system/rtc_export_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/rtc_export_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rtc_export_gn")
diff --git third_party/libwebrtc/rtc_base/system/unused_gn/moz.build third_party/libwebrtc/rtc_base/system/unused_gn/moz.build
index ca4dda9a2e4d..006c6586f890 100644
--- third_party/libwebrtc/rtc_base/system/unused_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/unused_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("unused_gn")
diff --git third_party/libwebrtc/rtc_base/system/warn_current_thread_is_deadlocked_gn/moz.build third_party/libwebrtc/rtc_base/system/warn_current_thread_is_deadlocked_gn/moz.build
index 39fd02456daa..bf0e8a8cd3f7 100644
--- third_party/libwebrtc/rtc_base/system/warn_current_thread_is_deadlocked_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/warn_current_thread_is_deadlocked_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("warn_current_thread_is_deadlocked_gn")
diff --git third_party/libwebrtc/rtc_base/task_utils/repeating_task_gn/moz.build third_party/libwebrtc/rtc_base/task_utils/repeating_task_gn/moz.build
index 087b4c4d88d2..e8429bb53f50 100644
--- third_party/libwebrtc/rtc_base/task_utils/repeating_task_gn/moz.build
+++ third_party/libwebrtc/rtc_base/task_utils/repeating_task_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("repeating_task_gn")
diff --git third_party/libwebrtc/rtc_base/third_party/base64/base64_gn/moz.build third_party/libwebrtc/rtc_base/third_party/base64/base64_gn/moz.build
index ae1efc51c7bd..6ef27d676626 100644
--- third_party/libwebrtc/rtc_base/third_party/base64/base64_gn/moz.build
+++ third_party/libwebrtc/rtc_base/third_party/base64/base64_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("base64_gn")
diff --git third_party/libwebrtc/rtc_base/third_party/sigslot/sigslot_gn/moz.build third_party/libwebrtc/rtc_base/third_party/sigslot/sigslot_gn/moz.build
index d5acb89419a4..7c934ab8aa45 100644
--- third_party/libwebrtc/rtc_base/third_party/sigslot/sigslot_gn/moz.build
+++ third_party/libwebrtc/rtc_base/third_party/sigslot/sigslot_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("sigslot_gn")
diff --git third_party/libwebrtc/rtc_base/threading_gn/moz.build third_party/libwebrtc/rtc_base/threading_gn/moz.build
index 25c10fd9be18..4bbc22347358 100644
--- third_party/libwebrtc/rtc_base/threading_gn/moz.build
+++ third_party/libwebrtc/rtc_base/threading_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -47,203 +56,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/rtc_base/physical_socket_server.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/rtc_base/physical_socket_server.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/rtc_base/physical_socket_server.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/rtc_base/physical_socket_server.cc"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("threading_gn")
diff --git third_party/libwebrtc/rtc_base/timeutils_gn/moz.build third_party/libwebrtc/rtc_base/timeutils_gn/moz.build
index 4a4eb9a5299d..c44c88674e94 100644
--- third_party/libwebrtc/rtc_base/timeutils_gn/moz.build
+++ third_party/libwebrtc/rtc_base/timeutils_gn/moz.build
@@ -13,12 +13,21 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_EXCLUDE_SYSTEM_TIME"] = True
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -46,186 +55,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("timeutils_gn")
diff --git third_party/libwebrtc/rtc_base/type_traits_gn/moz.build third_party/libwebrtc/rtc_base/type_traits_gn/moz.build
index f2f4e6b6ca45..ae4a3a9be6cc 100644
--- third_party/libwebrtc/rtc_base/type_traits_gn/moz.build
+++ third_party/libwebrtc/rtc_base/type_traits_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("type_traits_gn")
diff --git third_party/libwebrtc/rtc_base/unique_id_generator_gn/moz.build third_party/libwebrtc/rtc_base/unique_id_generator_gn/moz.build
index e1cd710315ee..7fdf646e5b07 100644
--- third_party/libwebrtc/rtc_base/unique_id_generator_gn/moz.build
+++ third_party/libwebrtc/rtc_base/unique_id_generator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("unique_id_generator_gn")
diff --git third_party/libwebrtc/rtc_base/units/unit_base_gn/moz.build third_party/libwebrtc/rtc_base/units/unit_base_gn/moz.build
index cd430975e933..5415e6422549 100644
--- third_party/libwebrtc/rtc_base/units/unit_base_gn/moz.build
+++ third_party/libwebrtc/rtc_base/units/unit_base_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,112 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -155,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("unit_base_gn")
diff --git third_party/libwebrtc/rtc_base/weak_ptr_gn/moz.build third_party/libwebrtc/rtc_base/weak_ptr_gn/moz.build
index abd3030f27e3..d0ec863efabb 100644
--- third_party/libwebrtc/rtc_base/weak_ptr_gn/moz.build
+++ third_party/libwebrtc/rtc_base/weak_ptr_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("weak_ptr_gn")
diff --git third_party/libwebrtc/rtc_base/win/create_direct3d_device_gn/moz.build third_party/libwebrtc/rtc_base/win/create_direct3d_device_gn/moz.build
deleted file mode 100644
index 93df4e562812..000000000000
--- third_party/libwebrtc/rtc_base/win/create_direct3d_device_gn/moz.build
+++ /dev/null
@@ -1,86 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-DEFINES["NOMINMAX"] = True
-DEFINES["NTDDI_VERSION"] = "0x0A000000"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["PSAPI_VERSION"] = "2"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["RTC_ENABLE_WIN_WGC"] = True
-DEFINES["UNICODE"] = True
-DEFINES["USE_AURA"] = "1"
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["WEBRTC_WIN"] = True
-DEFINES["WIN32"] = True
-DEFINES["WIN32_LEAN_AND_MEAN"] = True
-DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-DEFINES["WINVER"] = "0x0A00"
-DEFINES["_ATL_NO_OPENGL"] = True
-DEFINES["_CRT_RAND_S"] = True
-DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-DEFINES["_HAS_EXCEPTIONS"] = "0"
-DEFINES["_HAS_NODISCARD"] = True
-DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-DEFINES["_SECURE_ATL"] = True
-DEFINES["_UNICODE"] = True
-DEFINES["_WIN32_WINNT"] = "0x0A00"
-DEFINES["_WINDOWS"] = True
-DEFINES["__STD_C"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/tools/profiler/public"
-]
-
-UNIFIED_SOURCES += [
-    "/third_party/libwebrtc/rtc_base/win/create_direct3d_device.cc"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("create_direct3d_device_gn")
diff --git third_party/libwebrtc/rtc_base/win/get_activation_factory_gn/moz.build third_party/libwebrtc/rtc_base/win/get_activation_factory_gn/moz.build
deleted file mode 100644
index 8fa6b23b483a..000000000000
--- third_party/libwebrtc/rtc_base/win/get_activation_factory_gn/moz.build
+++ /dev/null
@@ -1,86 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-DEFINES["NOMINMAX"] = True
-DEFINES["NTDDI_VERSION"] = "0x0A000000"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["PSAPI_VERSION"] = "2"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["RTC_ENABLE_WIN_WGC"] = True
-DEFINES["UNICODE"] = True
-DEFINES["USE_AURA"] = "1"
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["WEBRTC_WIN"] = True
-DEFINES["WIN32"] = True
-DEFINES["WIN32_LEAN_AND_MEAN"] = True
-DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-DEFINES["WINVER"] = "0x0A00"
-DEFINES["_ATL_NO_OPENGL"] = True
-DEFINES["_CRT_RAND_S"] = True
-DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-DEFINES["_HAS_EXCEPTIONS"] = "0"
-DEFINES["_HAS_NODISCARD"] = True
-DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-DEFINES["_SECURE_ATL"] = True
-DEFINES["_UNICODE"] = True
-DEFINES["_WIN32_WINNT"] = "0x0A00"
-DEFINES["_WINDOWS"] = True
-DEFINES["__STD_C"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/tools/profiler/public"
-]
-
-UNIFIED_SOURCES += [
-    "/third_party/libwebrtc/rtc_base/win/get_activation_factory.cc"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("get_activation_factory_gn")
diff --git third_party/libwebrtc/rtc_base/win/hstring_gn/moz.build third_party/libwebrtc/rtc_base/win/hstring_gn/moz.build
deleted file mode 100644
index 5578d95daeba..000000000000
--- third_party/libwebrtc/rtc_base/win/hstring_gn/moz.build
+++ /dev/null
@@ -1,86 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-DEFINES["NOMINMAX"] = True
-DEFINES["NTDDI_VERSION"] = "0x0A000000"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["PSAPI_VERSION"] = "2"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["RTC_ENABLE_WIN_WGC"] = True
-DEFINES["UNICODE"] = True
-DEFINES["USE_AURA"] = "1"
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["WEBRTC_WIN"] = True
-DEFINES["WIN32"] = True
-DEFINES["WIN32_LEAN_AND_MEAN"] = True
-DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-DEFINES["WINVER"] = "0x0A00"
-DEFINES["_ATL_NO_OPENGL"] = True
-DEFINES["_CRT_RAND_S"] = True
-DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-DEFINES["_HAS_EXCEPTIONS"] = "0"
-DEFINES["_HAS_NODISCARD"] = True
-DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-DEFINES["_SECURE_ATL"] = True
-DEFINES["_UNICODE"] = True
-DEFINES["_WIN32_WINNT"] = "0x0A00"
-DEFINES["_WINDOWS"] = True
-DEFINES["__STD_C"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/tools/profiler/public"
-]
-
-SOURCES += [
-    "/third_party/libwebrtc/rtc_base/win/hstring.cc"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("hstring_gn")
diff --git third_party/libwebrtc/rtc_base/win/windows_version_gn/moz.build third_party/libwebrtc/rtc_base/win/windows_version_gn/moz.build
deleted file mode 100644
index 8875633ae5e1..000000000000
--- third_party/libwebrtc/rtc_base/win/windows_version_gn/moz.build
+++ /dev/null
@@ -1,86 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-DEFINES["NOMINMAX"] = True
-DEFINES["NTDDI_VERSION"] = "0x0A000000"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["PSAPI_VERSION"] = "2"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["RTC_ENABLE_WIN_WGC"] = True
-DEFINES["UNICODE"] = True
-DEFINES["USE_AURA"] = "1"
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["WEBRTC_WIN"] = True
-DEFINES["WIN32"] = True
-DEFINES["WIN32_LEAN_AND_MEAN"] = True
-DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-DEFINES["WINVER"] = "0x0A00"
-DEFINES["_ATL_NO_OPENGL"] = True
-DEFINES["_CRT_RAND_S"] = True
-DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-DEFINES["_HAS_EXCEPTIONS"] = "0"
-DEFINES["_HAS_NODISCARD"] = True
-DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-DEFINES["_SECURE_ATL"] = True
-DEFINES["_UNICODE"] = True
-DEFINES["_WIN32_WINNT"] = "0x0A00"
-DEFINES["_WINDOWS"] = True
-DEFINES["__STD_C"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/tools/profiler/public"
-]
-
-UNIFIED_SOURCES += [
-    "/third_party/libwebrtc/rtc_base/win/windows_version.cc"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("windows_version_gn")
diff --git third_party/libwebrtc/rtc_base/win32_gn/moz.build third_party/libwebrtc/rtc_base/win32_gn/moz.build
deleted file mode 100644
index cbdb0a0a3d14..000000000000
--- third_party/libwebrtc/rtc_base/win32_gn/moz.build
+++ /dev/null
@@ -1,93 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-DEFINES["NOMINMAX"] = True
-DEFINES["NTDDI_VERSION"] = "0x0A000000"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["PSAPI_VERSION"] = "2"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["RTC_ENABLE_WIN_WGC"] = True
-DEFINES["UNICODE"] = True
-DEFINES["USE_AURA"] = "1"
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["WEBRTC_WIN"] = True
-DEFINES["WIN32"] = True
-DEFINES["WIN32_LEAN_AND_MEAN"] = True
-DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-DEFINES["WINVER"] = "0x0A00"
-DEFINES["_ATL_NO_OPENGL"] = True
-DEFINES["_CRT_NONSTDC_NO_DEPRECATE"] = True
-DEFINES["_CRT_RAND_S"] = True
-DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-DEFINES["_HAS_EXCEPTIONS"] = "0"
-DEFINES["_HAS_NODISCARD"] = True
-DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-DEFINES["_SECURE_ATL"] = True
-DEFINES["_UNICODE"] = True
-DEFINES["_WIN32_WINNT"] = "0x0A00"
-DEFINES["_WINDOWS"] = True
-DEFINES["__STD_C"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/tools/profiler/public"
-]
-
-OS_LIBS += [
-    "crypt32",
-    "iphlpapi",
-    "secur32"
-]
-
-UNIFIED_SOURCES += [
-    "/third_party/libwebrtc/rtc_base/win32.cc"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("win32_gn")
diff --git third_party/libwebrtc/rtc_base/zero_memory_gn/moz.build third_party/libwebrtc/rtc_base/zero_memory_gn/moz.build
index 7c022b4d3b00..c5aebb895490 100644
--- third_party/libwebrtc/rtc_base/zero_memory_gn/moz.build
+++ third_party/libwebrtc/rtc_base/zero_memory_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("zero_memory_gn")
diff --git third_party/libwebrtc/sdk/base_objc_gn/moz.build third_party/libwebrtc/sdk/base_objc_gn/moz.build
deleted file mode 100644
index b717f3d73aea..000000000000
--- third_party/libwebrtc/sdk/base_objc_gn/moz.build
+++ /dev/null
@@ -1,81 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-CMFLAGS += [
-    "-fobjc-arc"
-]
-
-CMMFLAGS += [
-    "-fobjc-arc"
-]
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MAC"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_POSIX"] = True
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-DEFINES["__STDC_CONSTANT_MACROS"] = True
-DEFINES["__STDC_FORMAT_MACROS"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/third_party/libwebrtc/sdk/objc/",
-    "/third_party/libwebrtc/sdk/objc/base/",
-    "/tools/profiler/public"
-]
-
-UNIFIED_SOURCES += [
-    "/third_party/libwebrtc/sdk/objc/base/RTCEncodedImage.m",
-    "/third_party/libwebrtc/sdk/objc/base/RTCLogging.mm",
-    "/third_party/libwebrtc/sdk/objc/base/RTCVideoCapturer.m",
-    "/third_party/libwebrtc/sdk/objc/base/RTCVideoCodecInfo.m",
-    "/third_party/libwebrtc/sdk/objc/base/RTCVideoEncoderFactory.mm",
-    "/third_party/libwebrtc/sdk/objc/base/RTCVideoEncoderQpThresholds.m",
-    "/third_party/libwebrtc/sdk/objc/base/RTCVideoEncoderSettings.m",
-    "/third_party/libwebrtc/sdk/objc/base/RTCVideoFrame.mm"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("base_objc_gn")
diff --git third_party/libwebrtc/sdk/helpers_objc_gn/moz.build third_party/libwebrtc/sdk/helpers_objc_gn/moz.build
deleted file mode 100644
index 50505e56c2d0..000000000000
--- third_party/libwebrtc/sdk/helpers_objc_gn/moz.build
+++ /dev/null
@@ -1,76 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-CMFLAGS += [
-    "-fobjc-arc"
-]
-
-CMMFLAGS += [
-    "-fobjc-arc"
-]
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MAC"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_POSIX"] = True
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-DEFINES["__STDC_CONSTANT_MACROS"] = True
-DEFINES["__STDC_FORMAT_MACROS"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/third_party/libwebrtc/sdk/objc/",
-    "/third_party/libwebrtc/sdk/objc/base/",
-    "/tools/profiler/public"
-]
-
-UNIFIED_SOURCES += [
-    "/third_party/libwebrtc/sdk/objc/helpers/AVCaptureSession+DevicePosition.mm",
-    "/third_party/libwebrtc/sdk/objc/helpers/NSString+StdString.mm",
-    "/third_party/libwebrtc/sdk/objc/helpers/RTCDispatcher.m"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("helpers_objc_gn")
diff --git third_party/libwebrtc/sdk/videocapture_objc_gn/moz.build third_party/libwebrtc/sdk/videocapture_objc_gn/moz.build
deleted file mode 100644
index 178d8f87063a..000000000000
--- third_party/libwebrtc/sdk/videocapture_objc_gn/moz.build
+++ /dev/null
@@ -1,71 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-CMFLAGS += [
-    "-fobjc-arc"
-]
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MAC"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_POSIX"] = True
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-DEFINES["__STDC_CONSTANT_MACROS"] = True
-DEFINES["__STDC_FORMAT_MACROS"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/third_party/libwebrtc/sdk/objc/",
-    "/third_party/libwebrtc/sdk/objc/base/",
-    "/tools/profiler/public"
-]
-
-UNIFIED_SOURCES += [
-    "/third_party/libwebrtc/sdk/objc/components/capturer/RTCCameraVideoCapturer.m",
-    "/third_party/libwebrtc/sdk/objc/components/capturer/RTCFileVideoCapturer.m"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("videocapture_objc_gn")
diff --git third_party/libwebrtc/sdk/videoframebuffer_objc_gn/moz.build third_party/libwebrtc/sdk/videoframebuffer_objc_gn/moz.build
deleted file mode 100644
index 8c659d55bf23..000000000000
--- third_party/libwebrtc/sdk/videoframebuffer_objc_gn/moz.build
+++ /dev/null
@@ -1,74 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-  ### This moz.build was AUTOMATICALLY GENERATED from a GN config,  ###
-  ### DO NOT edit it by hand.                                       ###
-
-CMMFLAGS += [
-    "-fobjc-arc"
-]
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MAC"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_POSIX"] = True
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-DEFINES["__STDC_CONSTANT_MACROS"] = True
-DEFINES["__STDC_FORMAT_MACROS"] = True
-
-FINAL_LIBRARY = "xul"
-
-
-LOCAL_INCLUDES += [
-    "!/ipc/ipdl/_ipdlheaders",
-    "!/third_party/libwebrtc/gen",
-    "/ipc/chromium/src",
-    "/media/libyuv/",
-    "/media/libyuv/libyuv/include/",
-    "/third_party/abseil-cpp/",
-    "/third_party/libwebrtc/",
-    "/third_party/libwebrtc/sdk/objc/",
-    "/third_party/libwebrtc/sdk/objc/base/",
-    "/tools/profiler/public"
-]
-
-UNIFIED_SOURCES += [
-    "/third_party/libwebrtc/sdk/objc/api/video_frame_buffer/RTCNativeI420Buffer.mm",
-    "/third_party/libwebrtc/sdk/objc/api/video_frame_buffer/RTCNativeMutableI420Buffer.mm",
-    "/third_party/libwebrtc/sdk/objc/components/video_frame_buffer/RTCCVPixelBuffer.mm"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
-    DEFINES["NDEBUG"] = True
-    DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
-    DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-Library("videoframebuffer_objc_gn")
diff --git third_party/libwebrtc/system_wrappers/denormal_disabler_gn/moz.build third_party/libwebrtc/system_wrappers/denormal_disabler_gn/moz.build
index 8e69f1bd487a..10ca6bd2865c 100644
--- third_party/libwebrtc/system_wrappers/denormal_disabler_gn/moz.build
+++ third_party/libwebrtc/system_wrappers/denormal_disabler_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("denormal_disabler_gn")
diff --git third_party/libwebrtc/system_wrappers/field_trial_gn/moz.build third_party/libwebrtc/system_wrappers/field_trial_gn/moz.build
index 2c1b80184520..2982fabad79a 100644
--- third_party/libwebrtc/system_wrappers/field_trial_gn/moz.build
+++ third_party/libwebrtc/system_wrappers/field_trial_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("field_trial_gn")
diff --git third_party/libwebrtc/system_wrappers/metrics_gn/moz.build third_party/libwebrtc/system_wrappers/metrics_gn/moz.build
index 77e78153ea35..ad2149b736c2 100644
--- third_party/libwebrtc/system_wrappers/metrics_gn/moz.build
+++ third_party/libwebrtc/system_wrappers/metrics_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("metrics_gn")
diff --git third_party/libwebrtc/system_wrappers/system_wrappers_gn/moz.build third_party/libwebrtc/system_wrappers/system_wrappers_gn/moz.build
index 639e627348c4..e0895664e27d 100644
--- third_party/libwebrtc/system_wrappers/system_wrappers_gn/moz.build
+++ third_party/libwebrtc/system_wrappers/system_wrappers_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -48,200 +57,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    LOCAL_INCLUDES += [
-        "/config/external/nspr/",
-        "/nsprpub/lib/ds/",
-        "/nsprpub/pr/include/"
-    ]
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-    UNIFIED_SOURCES += [
-        "/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("system_wrappers_gn")
diff --git third_party/libwebrtc/test/network/simulated_network_gn/moz.build third_party/libwebrtc/test/network/simulated_network_gn/moz.build
index 32db92831a8b..b2fd5c533459 100644
--- third_party/libwebrtc/test/network/simulated_network_gn/moz.build
+++ third_party/libwebrtc/test/network/simulated_network_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("simulated_network_gn")
diff --git third_party/libwebrtc/test/rtp_test_utils_gn/moz.build third_party/libwebrtc/test/rtp_test_utils_gn/moz.build
index 2d610fe2fe88..e290a713c076 100644
--- third_party/libwebrtc/test/rtp_test_utils_gn/moz.build
+++ third_party/libwebrtc/test/rtp_test_utils_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,124 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -167,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("rtp_test_utils_gn")
diff --git third_party/libwebrtc/third_party/crc32c/crc32c_arm64_gn/moz.build third_party/libwebrtc/third_party/crc32c/crc32c_arm64_gn/moz.build
index d98bce783d99..8f144a997544 100644
--- third_party/libwebrtc/third_party/crc32c/crc32c_arm64_gn/moz.build
+++ third_party/libwebrtc/third_party/crc32c/crc32c_arm64_gn/moz.build
@@ -14,6 +14,15 @@ DEFINES["CRC32C_TESTS_BUILT_WITH_GLOG"] = "0"
 DEFINES["HAVE_ARM64_CRC32C"] = "0"
 DEFINES["HAVE_BUILTIN_PREFETCH"] = "1"
 DEFINES["HAVE_SSE42"] = "0"
+DEFINES["HAVE_STRONG_GETAUXVAL"] = "0"
+DEFINES["HAVE_WEAK_GETAUXVAL"] = "0"
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -41,107 +50,23 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "1"
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "0"
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "0"
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "1"
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "1"
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "0"
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "0"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "0"
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "0"
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["HAVE_MM_PREFETCH"] = "0"
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["HAVE_MM_PREFETCH"] = "0"
-
 if CONFIG["TARGET_CPU"] == "loongarch64":
 
     DEFINES["HAVE_MM_PREFETCH"] = "0"
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["HAVE_MM_PREFETCH"] = "0"
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "mips64":
 
     DEFINES["HAVE_MM_PREFETCH"] = "0"
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "ppc64":
 
@@ -153,66 +78,18 @@ if CONFIG["TARGET_CPU"] == "riscv64":
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["HAVE_MM_PREFETCH"] = "1"
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["HAVE_MM_PREFETCH"] = "1"
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["HAVE_MM_PREFETCH"] = "1"
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["HAVE_MM_PREFETCH"] = "1"
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("crc32c_arm64_gn")
diff --git third_party/libwebrtc/third_party/crc32c/crc32c_gn/moz.build third_party/libwebrtc/third_party/crc32c/crc32c_gn/moz.build
index 54cb56e40a71..ea59cd60aa8b 100644
--- third_party/libwebrtc/third_party/crc32c/crc32c_gn/moz.build
+++ third_party/libwebrtc/third_party/crc32c/crc32c_gn/moz.build
@@ -14,6 +14,15 @@ DEFINES["CRC32C_TESTS_BUILT_WITH_GLOG"] = "0"
 DEFINES["HAVE_ARM64_CRC32C"] = "0"
 DEFINES["HAVE_BUILTIN_PREFETCH"] = "1"
 DEFINES["HAVE_SSE42"] = "0"
+DEFINES["HAVE_STRONG_GETAUXVAL"] = "0"
+DEFINES["HAVE_WEAK_GETAUXVAL"] = "0"
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -42,107 +51,23 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "1"
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "0"
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "0"
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "1"
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "1"
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "0"
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "0"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "0"
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "0"
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["HAVE_MM_PREFETCH"] = "0"
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["HAVE_MM_PREFETCH"] = "0"
-
 if CONFIG["TARGET_CPU"] == "loongarch64":
 
     DEFINES["HAVE_MM_PREFETCH"] = "0"
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["HAVE_MM_PREFETCH"] = "0"
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "mips64":
 
     DEFINES["HAVE_MM_PREFETCH"] = "0"
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "ppc64":
 
@@ -154,66 +79,18 @@ if CONFIG["TARGET_CPU"] == "riscv64":
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["HAVE_MM_PREFETCH"] = "1"
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["HAVE_MM_PREFETCH"] = "1"
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["HAVE_MM_PREFETCH"] = "1"
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["HAVE_MM_PREFETCH"] = "1"
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("crc32c_gn")
diff --git third_party/libwebrtc/third_party/crc32c/crc32c_internal_headers_gn/moz.build third_party/libwebrtc/third_party/crc32c/crc32c_internal_headers_gn/moz.build
index 80580f19b47c..f7a92bd53658 100644
--- third_party/libwebrtc/third_party/crc32c/crc32c_internal_headers_gn/moz.build
+++ third_party/libwebrtc/third_party/crc32c/crc32c_internal_headers_gn/moz.build
@@ -9,6 +9,14 @@
 COMPILE_FLAGS["OS_INCLUDES"] = []
 AllowCompilerWarnings()
 
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
+
 FINAL_LIBRARY = "xul"
 
 
@@ -29,127 +37,10 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips32":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
     DEFINES["_DEBUG"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("crc32c_internal_headers_gn")
diff --git third_party/libwebrtc/third_party/crc32c/crc32c_sse42_gn/moz.build third_party/libwebrtc/third_party/crc32c/crc32c_sse42_gn/moz.build
index d06b3dade25e..4208f752cbc2 100644
--- third_party/libwebrtc/third_party/crc32c/crc32c_sse42_gn/moz.build
+++ third_party/libwebrtc/third_party/crc32c/crc32c_sse42_gn/moz.build
@@ -14,6 +14,15 @@ DEFINES["CRC32C_TESTS_BUILT_WITH_GLOG"] = "0"
 DEFINES["HAVE_ARM64_CRC32C"] = "0"
 DEFINES["HAVE_BUILTIN_PREFETCH"] = "1"
 DEFINES["HAVE_SSE42"] = "0"
+DEFINES["HAVE_STRONG_GETAUXVAL"] = "0"
+DEFINES["HAVE_WEAK_GETAUXVAL"] = "0"
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -41,107 +50,23 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "1"
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "0"
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "0"
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "1"
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "1"
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "0"
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "0"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["HAVE_STRONG_GETAUXVAL"] = "0"
-    DEFINES["HAVE_WEAK_GETAUXVAL"] = "0"
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["HAVE_MM_PREFETCH"] = "0"
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["HAVE_MM_PREFETCH"] = "0"
-
 if CONFIG["TARGET_CPU"] == "loongarch64":
 
     DEFINES["HAVE_MM_PREFETCH"] = "0"
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["HAVE_MM_PREFETCH"] = "0"
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "mips64":
 
     DEFINES["HAVE_MM_PREFETCH"] = "0"
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "ppc64":
 
@@ -153,66 +78,18 @@ if CONFIG["TARGET_CPU"] == "riscv64":
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["HAVE_MM_PREFETCH"] = "1"
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["HAVE_MM_PREFETCH"] = "1"
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["HAVE_MM_PREFETCH"] = "1"
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["HAVE_MM_PREFETCH"] = "1"
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("crc32c_sse42_gn")
diff --git third_party/libwebrtc/third_party/dav1d/dav1d_gn/moz.build third_party/libwebrtc/third_party/dav1d/dav1d_gn/moz.build
index 1bfed617a6fe..806fe6e74dc3 100644
--- third_party/libwebrtc/third_party/dav1d/dav1d_gn/moz.build
+++ third_party/libwebrtc/third_party/dav1d/dav1d_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -42,108 +51,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -153,50 +71,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("dav1d_gn")
diff --git third_party/libwebrtc/third_party/libaom/libaom_gn/moz.build third_party/libwebrtc/third_party/libaom/libaom_gn/moz.build
index 829835d9d69d..f861dd357a02 100644
--- third_party/libwebrtc/third_party/libaom/libaom_gn/moz.build
+++ third_party/libwebrtc/third_party/libaom/libaom_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,108 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -151,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("aom_gn")
diff --git third_party/libwebrtc/third_party/libepoxy/libepoxy_gn/moz.build third_party/libwebrtc/third_party/libepoxy/libepoxy_gn/moz.build
index 7d1347ef2c7f..2cd44f6fb564 100644
--- third_party/libwebrtc/third_party/libepoxy/libepoxy_gn/moz.build
+++ third_party/libwebrtc/third_party/libepoxy/libepoxy_gn/moz.build
@@ -13,20 +13,16 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["USE_AURA"] = "1"
 DEFINES["USE_GLIB"] = "1"
-DEFINES["USE_NSS_CERTS"] = "1"
 DEFINES["USE_OZONE"] = "1"
-DEFINES["USE_UDEV"] = True
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_LINUX"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
 DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
 DEFINES["_FILE_OFFSET_BITS"] = "64"
-DEFINES["_GNU_SOURCE"] = True
 DEFINES["_LARGEFILE64_SOURCE"] = True
 DEFINES["_LARGEFILE_SOURCE"] = True
 DEFINES["__STDC_CONSTANT_MACROS"] = True
@@ -62,12 +58,6 @@ if CONFIG["TARGET_CPU"] == "aarch64":
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
@@ -81,7 +71,7 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
diff --git third_party/libwebrtc/third_party/libyuv/libyuv_gn/moz.build third_party/libwebrtc/third_party/libyuv/libyuv_gn/moz.build
index 9f0e46f16702..6545a40c6ef1 100644
--- third_party/libwebrtc/third_party/libyuv/libyuv_gn/moz.build
+++ third_party/libwebrtc/third_party/libyuv/libyuv_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -42,108 +51,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -153,50 +71,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("yuv_gn")
diff --git third_party/libwebrtc/third_party/pffft/pffft_gn/moz.build third_party/libwebrtc/third_party/pffft/pffft_gn/moz.build
index dc7c06ffc21f..1617e9c2e1bb 100644
--- third_party/libwebrtc/third_party/pffft/pffft_gn/moz.build
+++ third_party/libwebrtc/third_party/pffft/pffft_gn/moz.build
@@ -9,6 +9,14 @@
 COMPILE_FLAGS["OS_INCLUDES"] = []
 AllowCompilerWarnings()
 
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
+
 FINAL_LIBRARY = "xul"
 
 
@@ -33,92 +41,19 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_USE_MATH_DEFINES"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CFLAGS += [
-        "-mfpu=neon"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "loongarch64":
 
     DEFINES["PFFFT_SIMD_DISABLE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["PFFFT_SIMD_DISABLE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "mips64":
 
     DEFINES["PFFFT_SIMD_DISABLE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "ppc64":
 
@@ -128,60 +63,14 @@ if CONFIG["TARGET_CPU"] == "riscv64":
 
     DEFINES["PFFFT_SIMD_DISABLE"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["TARGET_CPU"] == "x86":
 
     CFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    CFLAGS += [
-        "-msse2"
-    ]
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("pffft_gn")
diff --git third_party/libwebrtc/third_party/rnnoise/rnn_vad_gn/moz.build third_party/libwebrtc/third_party/rnnoise/rnn_vad_gn/moz.build
index 2dfd79a68cf7..3703f7ef3366 100644
--- third_party/libwebrtc/third_party/rnnoise/rnn_vad_gn/moz.build
+++ third_party/libwebrtc/third_party/rnnoise/rnn_vad_gn/moz.build
@@ -9,6 +9,14 @@
 COMPILE_FLAGS["OS_INCLUDES"] = []
 AllowCompilerWarnings()
 
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
+
 FINAL_LIBRARY = "xul"
 
 
@@ -33,143 +41,16 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips32":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
     DEFINES["_DEBUG"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
-    CXXFLAGS += [
-        "-msse2"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+if CONFIG["TARGET_CPU"] == "x86":
 
     CXXFLAGS += [
         "-msse2"
     ]
 
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("rnn_vad_gn")
diff --git third_party/libwebrtc/video/adaptation/video_adaptation_gn/moz.build third_party/libwebrtc/video/adaptation/video_adaptation_gn/moz.build
index 2c62e9cbe092..d82fa66a2945 100644
--- third_party/libwebrtc/video/adaptation/video_adaptation_gn/moz.build
+++ third_party/libwebrtc/video/adaptation/video_adaptation_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -52,191 +61,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_adaptation_gn")
diff --git third_party/libwebrtc/video/config/encoder_config_gn/moz.build third_party/libwebrtc/video/config/encoder_config_gn/moz.build
index 8f1b9bb33967..a7be3784a0df 100644
--- third_party/libwebrtc/video/config/encoder_config_gn/moz.build
+++ third_party/libwebrtc/video/config/encoder_config_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("encoder_config_gn")
diff --git third_party/libwebrtc/video/config/streams_config_gn/moz.build third_party/libwebrtc/video/config/streams_config_gn/moz.build
index f8965ab6f5df..7981a149e1f0 100644
--- third_party/libwebrtc/video/config/streams_config_gn/moz.build
+++ third_party/libwebrtc/video/config/streams_config_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -45,191 +54,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("streams_config_gn")
diff --git third_party/libwebrtc/video/corruption_detection/corruption_classifier_gn/moz.build third_party/libwebrtc/video/corruption_detection/corruption_classifier_gn/moz.build
index 0e4f9c57e0ae..d6e888a454a7 100644
--- third_party/libwebrtc/video/corruption_detection/corruption_classifier_gn/moz.build
+++ third_party/libwebrtc/video/corruption_detection/corruption_classifier_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("corruption_classifier_gn")
diff --git third_party/libwebrtc/video/corruption_detection/frame_instrumentation_evaluation_gn/moz.build third_party/libwebrtc/video/corruption_detection/frame_instrumentation_evaluation_gn/moz.build
index 5f3217f3222e..610cdfe12383 100644
--- third_party/libwebrtc/video/corruption_detection/frame_instrumentation_evaluation_gn/moz.build
+++ third_party/libwebrtc/video/corruption_detection/frame_instrumentation_evaluation_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frame_instrumentation_evaluation_gn")
diff --git third_party/libwebrtc/video/corruption_detection/frame_instrumentation_generator_gn/moz.build third_party/libwebrtc/video/corruption_detection/frame_instrumentation_generator_gn/moz.build
index 9d03622daa05..81d9185c0a7d 100644
--- third_party/libwebrtc/video/corruption_detection/frame_instrumentation_generator_gn/moz.build
+++ third_party/libwebrtc/video/corruption_detection/frame_instrumentation_generator_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frame_instrumentation_generator_gn")
diff --git third_party/libwebrtc/video/corruption_detection/generic_mapping_functions_gn/moz.build third_party/libwebrtc/video/corruption_detection/generic_mapping_functions_gn/moz.build
index 37551c088b6f..166e00c8e94b 100644
--- third_party/libwebrtc/video/corruption_detection/generic_mapping_functions_gn/moz.build
+++ third_party/libwebrtc/video/corruption_detection/generic_mapping_functions_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("generic_mapping_functions_gn")
diff --git third_party/libwebrtc/video/corruption_detection/halton_frame_sampler_gn/moz.build third_party/libwebrtc/video/corruption_detection/halton_frame_sampler_gn/moz.build
index d1ea963e5731..336c6e382e2f 100644
--- third_party/libwebrtc/video/corruption_detection/halton_frame_sampler_gn/moz.build
+++ third_party/libwebrtc/video/corruption_detection/halton_frame_sampler_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("halton_frame_sampler_gn")
diff --git third_party/libwebrtc/video/corruption_detection/halton_sequence_gn/moz.build third_party/libwebrtc/video/corruption_detection/halton_sequence_gn/moz.build
index 2ca4023e96ed..ef1e0a772a9a 100644
--- third_party/libwebrtc/video/corruption_detection/halton_sequence_gn/moz.build
+++ third_party/libwebrtc/video/corruption_detection/halton_sequence_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,179 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("halton_sequence_gn")
diff --git third_party/libwebrtc/video/decode_synchronizer_gn/moz.build third_party/libwebrtc/video/decode_synchronizer_gn/moz.build
index 27a93ff88bdf..4cb2ebd4a0ea 100644
--- third_party/libwebrtc/video/decode_synchronizer_gn/moz.build
+++ third_party/libwebrtc/video/decode_synchronizer_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("decode_synchronizer_gn")
diff --git third_party/libwebrtc/video/frame_cadence_adapter_gn/moz.build third_party/libwebrtc/video/frame_cadence_adapter_gn/moz.build
index 6833cde2b29a..94ba7405ba0e 100644
--- third_party/libwebrtc/video/frame_cadence_adapter_gn/moz.build
+++ third_party/libwebrtc/video/frame_cadence_adapter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frame_cadence_adapter_gn")
diff --git third_party/libwebrtc/video/frame_decode_scheduler_gn/moz.build third_party/libwebrtc/video/frame_decode_scheduler_gn/moz.build
index 492e8396d7f1..35c08dd6c9da 100644
--- third_party/libwebrtc/video/frame_decode_scheduler_gn/moz.build
+++ third_party/libwebrtc/video/frame_decode_scheduler_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,123 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -166,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("frame_decode_scheduler_gn")
diff --git third_party/libwebrtc/video/frame_decode_timing_gn/moz.build third_party/libwebrtc/video/frame_decode_timing_gn/moz.build
index 58a909e8d4b0..f7d64ab60379 100644
--- third_party/libwebrtc/video/frame_decode_timing_gn/moz.build
+++ third_party/libwebrtc/video/frame_decode_timing_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frame_decode_timing_gn")
diff --git third_party/libwebrtc/video/frame_dumping_decoder_gn/moz.build third_party/libwebrtc/video/frame_dumping_decoder_gn/moz.build
index 2b688c034655..566b0c806c68 100644
--- third_party/libwebrtc/video/frame_dumping_decoder_gn/moz.build
+++ third_party/libwebrtc/video/frame_dumping_decoder_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frame_dumping_decoder_gn")
diff --git third_party/libwebrtc/video/frame_dumping_encoder_gn/moz.build third_party/libwebrtc/video/frame_dumping_encoder_gn/moz.build
index 7205ea8c1cf3..dd0edb14e927 100644
--- third_party/libwebrtc/video/frame_dumping_encoder_gn/moz.build
+++ third_party/libwebrtc/video/frame_dumping_encoder_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("frame_dumping_encoder_gn")
diff --git third_party/libwebrtc/video/render/incoming_video_stream_gn/moz.build third_party/libwebrtc/video/render/incoming_video_stream_gn/moz.build
index 4b7bf065fbf1..450ec1241bb6 100644
--- third_party/libwebrtc/video/render/incoming_video_stream_gn/moz.build
+++ third_party/libwebrtc/video/render/incoming_video_stream_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("incoming_video_stream_gn")
diff --git third_party/libwebrtc/video/render/video_render_frames_gn/moz.build third_party/libwebrtc/video/render/video_render_frames_gn/moz.build
index 40c2cc0ee11c..afc161293679 100644
--- third_party/libwebrtc/video/render/video_render_frames_gn/moz.build
+++ third_party/libwebrtc/video/render/video_render_frames_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,186 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_render_frames_gn")
diff --git third_party/libwebrtc/video/task_queue_frame_decode_scheduler_gn/moz.build third_party/libwebrtc/video/task_queue_frame_decode_scheduler_gn/moz.build
index f48a99ae30f0..278644a5eed5 100644
--- third_party/libwebrtc/video/task_queue_frame_decode_scheduler_gn/moz.build
+++ third_party/libwebrtc/video/task_queue_frame_decode_scheduler_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("task_queue_frame_decode_scheduler_gn")
diff --git third_party/libwebrtc/video/unique_timestamp_counter_gn/moz.build third_party/libwebrtc/video/unique_timestamp_counter_gn/moz.build
index 44c3fed1208b..feacfc5d5716 100644
--- third_party/libwebrtc/video/unique_timestamp_counter_gn/moz.build
+++ third_party/libwebrtc/video/unique_timestamp_counter_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,175 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("unique_timestamp_counter_gn")
diff --git third_party/libwebrtc/video/video_gn/moz.build third_party/libwebrtc/video/video_gn/moz.build
index 86ce29262eb6..db6309640745 100644
--- third_party/libwebrtc/video/video_gn/moz.build
+++ third_party/libwebrtc/video/video_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -63,191 +72,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_gn")
diff --git third_party/libwebrtc/video/video_receive_stream_timeout_tracker_gn/moz.build third_party/libwebrtc/video/video_receive_stream_timeout_tracker_gn/moz.build
index 12d0513ca083..a938e5cb2bf2 100644
--- third_party/libwebrtc/video/video_receive_stream_timeout_tracker_gn/moz.build
+++ third_party/libwebrtc/video/video_receive_stream_timeout_tracker_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,190 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_receive_stream_timeout_tracker_gn")
diff --git third_party/libwebrtc/video/video_stream_buffer_controller_gn/moz.build third_party/libwebrtc/video/video_stream_buffer_controller_gn/moz.build
index a197def242bb..84863d3a8c02 100644
--- third_party/libwebrtc/video/video_stream_buffer_controller_gn/moz.build
+++ third_party/libwebrtc/video/video_stream_buffer_controller_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -44,191 +53,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_stream_buffer_controller_gn")
diff --git third_party/libwebrtc/video/video_stream_encoder_impl_gn/moz.build third_party/libwebrtc/video/video_stream_encoder_impl_gn/moz.build
index 6ea5c303a15d..c678f28a8343 100644
--- third_party/libwebrtc/video/video_stream_encoder_impl_gn/moz.build
+++ third_party/libwebrtc/video/video_stream_encoder_impl_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -52,191 +61,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["USE_X11"] = "1"
 
 Library("video_stream_encoder_impl_gn")
diff --git third_party/libwebrtc/video/video_stream_encoder_interface_gn/moz.build third_party/libwebrtc/video/video_stream_encoder_interface_gn/moz.build
index b270923b1375..89c31ebae9ee 100644
--- third_party/libwebrtc/video/video_stream_encoder_interface_gn/moz.build
+++ third_party/libwebrtc/video/video_stream_encoder_interface_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,119 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -162,50 +69,8 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("video_stream_encoder_interface_gn")
diff --git third_party/libwebrtc/webrtc_gn/moz.build third_party/libwebrtc/webrtc_gn/moz.build
index 0bf8e11b5430..e393c24e9a7b 100644
--- third_party/libwebrtc/webrtc_gn/moz.build
+++ third_party/libwebrtc/webrtc_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII"] = "0"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -40,147 +49,17 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "GLESv2",
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    LOCAL_INCLUDES += [
-        "/third_party/libwebrtc/sdk/objc/",
-        "/third_party/libwebrtc/sdk/objc/base/"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "rt"
-    ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "X11",
-        "Xcomposite",
-        "Xdamage",
-        "Xext",
-        "Xfixes",
-        "Xrandr",
-        "Xrender"
-    ]
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "d3d11",
-        "dwmapi",
-        "dxgi",
-        "iphlpapi",
-        "ole32",
-        "oleaut32",
-        "secur32",
-        "shcore",
-        "strmiids",
-        "user32",
-        "winmm"
-    ]
+    DEFINES["_DEBUG"] = True
 
 if CONFIG["TARGET_CPU"] == "aarch64":
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
@@ -190,27 +69,7 @@ if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
@@ -224,26 +83,4 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
         "Xrender"
     ]
 
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 Library("webrtc_gn")
