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

    regenerate FreeBSD libwebrtc patch for Firefox 138

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 655ef59cba4b..d54f6dbed565 100644
--- third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build
+++ third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 d4382d1df1cc..0a1c7b839dda 100644
--- third_party/libwebrtc/api/array_view_gn/moz.build
+++ third_party/libwebrtc/api/array_view_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 e935019626ad..b6efeac78e76 100644
--- third_party/libwebrtc/api/async_dns_resolver_gn/moz.build
+++ third_party/libwebrtc/api/async_dns_resolver_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,120 +48,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":
 
@@ -162,50 +68,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 cfb3b6961c8e..daf2b9c13beb 100644
--- third_party/libwebrtc/api/audio/aec3_config_gn/moz.build
+++ third_party/libwebrtc/api/audio/aec3_config_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 589d5a72ef9b..9311473ef1a8 100644
--- third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build
+++ third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -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("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 a727e70ec91d..956114463750 100644
--- third_party/libwebrtc/api/audio/audio_device_gn/moz.build
+++ third_party/libwebrtc/api/audio/audio_device_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 0cf70f6a0a66..f121290ac495 100644
--- third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build
+++ third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 d9e237b4c753..f34df50bef47 100644
--- third_party/libwebrtc/api/audio/audio_frame_processor_gn/moz.build
+++ third_party/libwebrtc/api/audio/audio_frame_processor_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 9576084c2bfb..aca2a4d6a37f 100644
--- third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build
+++ third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 2e7d38d911f4..fb9329509240 100644
--- third_party/libwebrtc/api/audio/audio_processing_gn/moz.build
+++ third_party/libwebrtc/api/audio/audio_processing_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 0400bcf1bdfc..9275b9e39050 100644
--- third_party/libwebrtc/api/audio/audio_processing_statistics_gn/moz.build
+++ third_party/libwebrtc/api/audio/audio_processing_statistics_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 af681d4d0d28..dd6059825208 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
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -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("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 904a224b5a88..9bb9eff44ed7 100644
--- third_party/libwebrtc/api/audio/echo_control_gn/moz.build
+++ third_party/libwebrtc/api/audio/echo_control_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 ae4047c15bad..b7d03e2fb268 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 9007bea06a57..5c76a4bbb10f 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 1de066daa01e..475c29ae92d2 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 be74a5a11b8d..517b3b57ed6b 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
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 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"
 
@@ -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("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 f6a0d16b0b5c..4c5f8099504f 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
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 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"
 
@@ -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("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 58fffb2e22d1..c883304f6928 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 7f12ebe49f01..0399f439f107 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 e808e4298249..d9457426de70 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 5e4da695b94a..724106b4aea7 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 1ea3e2809c53..4d8340d021cd 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 37f380708aa3..abf91648be19 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 38ae3cb77d4a..ec98b9e1da9d 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 7c496999196d..1ef54111434a 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 089a1a45e301..233f98cf79a9 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 a51951b06a09..2d9efa02ffa4 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
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["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"
 
@@ -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":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
-    ]
-
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "loongarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
 if CONFIG["TARGET_CPU"] == "mips32":
 
     DEFINES["MIPS32_LE"] = True
     DEFINES["MIPS_FPU_LE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
-    DEFINES["_GNU_SOURCE"] = True
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
-    DEFINES["_GNU_SOURCE"] = True
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
 
-if CONFIG["OS_TARGET"] == "Linux" and 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 8b4a7d737129..1d68afeb665c 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 394c4633e5be..a8566871ce2d 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 f3d9e0c5c619..c8cc49dfc388 100644
--- third_party/libwebrtc/api/audio_options_api_gn/moz.build
+++ third_party/libwebrtc/api/audio_options_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 5afb81f93349..1125b25cc2fe 100644
--- third_party/libwebrtc/api/bitrate_allocation_gn/moz.build
+++ third_party/libwebrtc/api/bitrate_allocation_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 87ce5be77f85..abcfd171700e 100644
--- third_party/libwebrtc/api/call_api_gn/moz.build
+++ third_party/libwebrtc/api/call_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 f04389690b02..d7c73ce42b03 100644
--- third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build
+++ third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 4085a759f65d..2388275f9ba6 100644
--- third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build
+++ third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 924a8c8bad70..82a22cce2ccd 100644
--- third_party/libwebrtc/api/crypto/options_gn/moz.build
+++ third_party/libwebrtc/api/crypto/options_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 76d8ff92e999..debb1ddd5c3a 100644
--- third_party/libwebrtc/api/environment/environment_factory_gn/moz.build
+++ third_party/libwebrtc/api/environment/environment_factory_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 0bb75b315e5a..000242d51165 100644
--- third_party/libwebrtc/api/environment/environment_gn/moz.build
+++ third_party/libwebrtc/api/environment/environment_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 fef918e83259..d83eac28dd73 100644
--- third_party/libwebrtc/api/fec_controller_api_gn/moz.build
+++ third_party/libwebrtc/api/fec_controller_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 8e25c5f0af23..27d919a95bd9 100644
--- third_party/libwebrtc/api/field_trials_registry_gn/moz.build
+++ third_party/libwebrtc/api/field_trials_registry_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 3b251e442736..935aaf609f1e 100644
--- third_party/libwebrtc/api/field_trials_view_gn/moz.build
+++ third_party/libwebrtc/api/field_trials_view_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 f4f1de37c757..7bd0919f032f 100644
--- third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build
+++ third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 ead33463bfc3..6f7ba527bf72 100644
--- third_party/libwebrtc/api/function_view_gn/moz.build
+++ third_party/libwebrtc/api/function_view_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 d7611c9edebe..451b3e815625 100644
--- third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build
+++ third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 8b5a49c259d0..381fb63fcfbf 100644
--- third_party/libwebrtc/api/libjingle_peerconnection_api_gn/moz.build
+++ third_party/libwebrtc/api/libjingle_peerconnection_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 cae29c6f01cd..9c6045f7715e 100644
--- third_party/libwebrtc/api/location_gn/moz.build
+++ third_party/libwebrtc/api/location_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 e7975c529738..23fb60720340 100644
--- third_party/libwebrtc/api/make_ref_counted_gn/moz.build
+++ third_party/libwebrtc/api/make_ref_counted_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 5b64e7f79ad8..a29d14c3f815 100644
--- third_party/libwebrtc/api/media_stream_interface_gn/moz.build
+++ third_party/libwebrtc/api/media_stream_interface_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 dcd60714813d..de97bbbba76f 100644
--- third_party/libwebrtc/api/metronome/metronome_gn/moz.build
+++ third_party/libwebrtc/api/metronome/metronome_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 ebb57e97affb..2a03f232a3f2 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 96f2fffa5e33..02e6017182d4 100644
--- third_party/libwebrtc/api/neteq/default_neteq_factory_gn/moz.build
+++ third_party/libwebrtc/api/neteq/default_neteq_factory_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 e619d4fb5ab9..b4bd72fd9699 100644
--- third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build
+++ third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 9baed43dc5ab..32fc005477ae 100644
--- third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build
+++ third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 a0ca1dd76f9a..df6cea066912 100644
--- third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build
+++ third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 348bf16eecf1..9c5e0ac36215 100644
--- third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build
+++ third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 bae63c2cb1cc..81b1938a5747 100644
--- third_party/libwebrtc/api/priority_gn/moz.build
+++ third_party/libwebrtc/api/priority_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 02086e698dc8..dc07e0f1d07f 100644
--- third_party/libwebrtc/api/ref_count_gn/moz.build
+++ third_party/libwebrtc/api/ref_count_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 52fcc299027f..bc3c0a28cb23 100644
--- third_party/libwebrtc/api/refcountedbase_gn/moz.build
+++ third_party/libwebrtc/api/refcountedbase_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 236d348fb3da..14dc0fc7363c 100644
--- third_party/libwebrtc/api/rtc_error_gn/moz.build
+++ third_party/libwebrtc/api/rtc_error_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 711bf9c77efb..729beed1bc12 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_log_gn")
diff --git third_party/libwebrtc/api/rtp_headers_gn/moz.build third_party/libwebrtc/api/rtp_headers_gn/moz.build
index 41c4e99db55e..8336baf5c775 100644
--- third_party/libwebrtc/api/rtp_headers_gn/moz.build
+++ third_party/libwebrtc/api/rtp_headers_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 9c1735f23770..49697fe94030 100644
--- third_party/libwebrtc/api/rtp_packet_info_gn/moz.build
+++ third_party/libwebrtc/api/rtp_packet_info_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 0496394c6b64..00fa8cacf263 100644
--- third_party/libwebrtc/api/rtp_packet_sender_gn/moz.build
+++ third_party/libwebrtc/api/rtp_packet_sender_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 08553627768d..c163c9cf05b9 100644
--- third_party/libwebrtc/api/rtp_parameters_gn/moz.build
+++ third_party/libwebrtc/api/rtp_parameters_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 3b12029bdc36..362c773c7fd2 100644
--- third_party/libwebrtc/api/rtp_sender_interface_gn/moz.build
+++ third_party/libwebrtc/api/rtp_sender_interface_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 cea07d6922c0..ea214198799a 100644
--- third_party/libwebrtc/api/rtp_sender_setparameters_callback_gn/moz.build
+++ third_party/libwebrtc/api/rtp_sender_setparameters_callback_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 b80b352927ed..1090214b4d41 100644
--- third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build
+++ third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 562cb4ae55f8..05723cb68f60 100644
--- third_party/libwebrtc/api/scoped_refptr_gn/moz.build
+++ third_party/libwebrtc/api/scoped_refptr_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 191ccae1f939..42cf01fa9d47 100644
--- third_party/libwebrtc/api/sequence_checker_gn/moz.build
+++ third_party/libwebrtc/api/sequence_checker_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 558f8ca50fda..d5b1312c38f6 100644
--- third_party/libwebrtc/api/simulated_network_api_gn/moz.build
+++ third_party/libwebrtc/api/simulated_network_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 6a4453ac73ee..46673406c667 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 beda60da9198..c519cfaeab49 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 3ea55a8b7684..7734743729b9 100644
--- third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build
+++ third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 63460f387b3a..3c4c34510df6 100644
--- third_party/libwebrtc/api/transport/bandwidth_estimation_settings_gn/moz.build
+++ third_party/libwebrtc/api/transport/bandwidth_estimation_settings_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 7e80ecfe46b3..8b2281068103 100644
--- third_party/libwebrtc/api/transport/bandwidth_usage_gn/moz.build
+++ third_party/libwebrtc/api/transport/bandwidth_usage_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 25a3c741839e..c3027c3972c5 100644
--- third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build
+++ third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 b11138679c25..19c008c92ffe 100644
--- third_party/libwebrtc/api/transport/datagram_transport_interface_gn/moz.build
+++ third_party/libwebrtc/api/transport/datagram_transport_interface_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 6c4cd224b98b..bc515fc5c103 100644
--- third_party/libwebrtc/api/transport/ecn_marking_gn/moz.build
+++ third_party/libwebrtc/api/transport/ecn_marking_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 c47158aa87fe..842473731ca0 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 89be00e883b4..6e7e204ba661 100644
--- third_party/libwebrtc/api/transport/goog_cc_gn/moz.build
+++ third_party/libwebrtc/api/transport/goog_cc_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 7ae9e4b54679..d79bb6509222 100644
--- third_party/libwebrtc/api/transport/network_control_gn/moz.build
+++ third_party/libwebrtc/api/transport/network_control_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 5c94efb78495..915f17ef72d7 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 fa5f3fb195e6..a2bad5bb1bca 100644
--- third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build
+++ third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 34b4824b5f54..8986e9975515 100644
--- third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build
+++ third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 865d9643a41c..eb2eea46c3a1 100644
--- third_party/libwebrtc/api/transport/stun_types_gn/moz.build
+++ third_party/libwebrtc/api/transport/stun_types_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 7f3192c2bcfd..d2dee618fe31 100644
--- third_party/libwebrtc/api/transport_api_gn/moz.build
+++ third_party/libwebrtc/api/transport_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 720807906a65..40749dda50cc 100644
--- third_party/libwebrtc/api/units/data_rate_gn/moz.build
+++ third_party/libwebrtc/api/units/data_rate_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 3c005ff583f4..861ba03b8ee4 100644
--- third_party/libwebrtc/api/units/data_size_gn/moz.build
+++ third_party/libwebrtc/api/units/data_size_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 7e1b55def133..df8a867d45be 100644
--- third_party/libwebrtc/api/units/frequency_gn/moz.build
+++ third_party/libwebrtc/api/units/frequency_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 aebee68119cb..09ebe7ab3b88 100644
--- third_party/libwebrtc/api/units/time_delta_gn/moz.build
+++ third_party/libwebrtc/api/units/time_delta_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 d80b973f5ee3..7b73258ae847 100644
--- third_party/libwebrtc/api/units/timestamp_gn/moz.build
+++ third_party/libwebrtc/api/units/timestamp_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 a4ec365080f6..383a9f5f8f65 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 5d7da48cc742..300e8ee3846f 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 1727272f7e0f..6ce825420c3d 100644
--- third_party/libwebrtc/api/video/encoded_frame_gn/moz.build
+++ third_party/libwebrtc/api/video/encoded_frame_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 52b2c556a941..0213de1b0ebb 100644
--- third_party/libwebrtc/api/video/encoded_image_gn/moz.build
+++ third_party/libwebrtc/api/video/encoded_image_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 384cb719cb2f..d2f349ceca3b 100644
--- third_party/libwebrtc/api/video/frame_buffer_gn/moz.build
+++ third_party/libwebrtc/api/video/frame_buffer_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 b0f0ce639337..c56e910a6a20 100644
--- third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build
+++ third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 0af4d7d36209..136648ce930d 100644
--- third_party/libwebrtc/api/video/render_resolution_gn/moz.build
+++ third_party/libwebrtc/api/video/render_resolution_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 74a183e25263..aa69c5c25fd4 100644
--- third_party/libwebrtc/api/video/resolution_gn/moz.build
+++ third_party/libwebrtc/api/video/resolution_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 cf8c377621aa..5118a4fd59c2 100644
--- third_party/libwebrtc/api/video/video_adaptation_gn/moz.build
+++ third_party/libwebrtc/api/video/video_adaptation_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 6f16ff5da34f..71b911ecfde6 100644
--- third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build
+++ third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 1ff1aaa06a61..77a13b931813 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 bd4e602db36e..2280ad344922 100644
--- third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build
+++ third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 0b0d1a059d94..bd3794236930 100644
--- third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build
+++ third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 5c42b97b37a9..7fc4f4ab76f0 100644
--- third_party/libwebrtc/api/video/video_frame_gn/moz.build
+++ third_party/libwebrtc/api/video/video_frame_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 961ffc81e65b..4cfb3cc01351 100644
--- third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build
+++ third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,186 +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
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 d81fad8e90ec..6f1776416d79 100644
--- third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build
+++ third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 35cbbb6faf29..72dadbd449b5 100644
--- third_party/libwebrtc/api/video/video_frame_type_gn/moz.build
+++ third_party/libwebrtc/api/video/video_frame_type_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 087e4d2b3b38..00846604156c 100644
--- third_party/libwebrtc/api/video/video_layers_allocation_gn/moz.build
+++ third_party/libwebrtc/api/video/video_layers_allocation_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 9795785a7286..67af495f375a 100644
--- third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build
+++ third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 e35fcc49d5aa..98abab04b82a 100644
--- third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build
+++ third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 298a78c8a844..b9317d51313f 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 e79ca13c7d5b..d4dfd0c7a10b 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 f503a3b205df..e50a808f3a90 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 15814eeed8b6..7e8b6e8cfa6c 100644
--- third_party/libwebrtc/api/video_codecs/scalability_mode_gn/moz.build
+++ third_party/libwebrtc/api/video_codecs/scalability_mode_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 7e065afaab4e..04ad9ac19993 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,186 +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
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 5dad1e3674d2..bb5aeb6b5d3d 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 70cf72d1ea8f..b8e0b45c28a2 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,123 +48,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":
 
@@ -165,50 +68,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 5a44aee34808..57f83fc9486b 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,124 +48,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":
 
@@ -166,50 +68,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 268c7c01b2dd..c0ffd9aab90f 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,124 +48,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":
 
@@ -166,50 +68,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 3046da6a470f..7237fb0ba38b 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,124 +48,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":
 
@@ -166,50 +68,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 487c0d9471e1..2fe2304cb942 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 eed553ce968c..a9bb083e07d3 100644
--- third_party/libwebrtc/api/video_track_source_constraints_gn/moz.build
+++ third_party/libwebrtc/api/video_track_source_constraints_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 c52d2d8ec5d5..570c4597d2ab 100644
--- third_party/libwebrtc/audio/audio_gn/moz.build
+++ third_party/libwebrtc/audio/audio_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,191 +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 += [
-        "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 41ec2166f76b..80914acd5839 100644
--- third_party/libwebrtc/audio/utility/audio_frame_operations_gn/moz.build
+++ third_party/libwebrtc/audio/utility/audio_frame_operations_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 b47b7f67124e..0115d47e0857 100644
--- third_party/libwebrtc/call/adaptation/resource_adaptation_gn/moz.build
+++ third_party/libwebrtc/call/adaptation/resource_adaptation_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 64613d5febf2..1e65cb180fd1 100644
--- third_party/libwebrtc/call/audio_sender_interface_gn/moz.build
+++ third_party/libwebrtc/call/audio_sender_interface_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 f881adeec2c7..0f207f759b9d 100644
--- third_party/libwebrtc/call/bitrate_allocator_gn/moz.build
+++ third_party/libwebrtc/call/bitrate_allocator_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 1c8d60c87c7d..9d7cd391892f 100644
--- third_party/libwebrtc/call/bitrate_configurator_gn/moz.build
+++ third_party/libwebrtc/call/bitrate_configurator_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 554f25cfb490..b1723ba1715c 100644
--- third_party/libwebrtc/call/call_gn/moz.build
+++ third_party/libwebrtc/call/call_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("call_gn")
diff --git third_party/libwebrtc/call/call_interfaces_gn/moz.build third_party/libwebrtc/call/call_interfaces_gn/moz.build
index 01a07308c01b..1f5bb9bae089 100644
--- third_party/libwebrtc/call/call_interfaces_gn/moz.build
+++ third_party/libwebrtc/call/call_interfaces_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("call_interfaces_gn")
diff --git third_party/libwebrtc/call/payload_type_gn/moz.build third_party/libwebrtc/call/payload_type_gn/moz.build
index 4ee6afa8af43..a56032559c58 100644
--- third_party/libwebrtc/call/payload_type_gn/moz.build
+++ third_party/libwebrtc/call/payload_type_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 9882d5dcd22c..7c7bf3c21180 100644
--- third_party/libwebrtc/call/payload_type_picker_gn/moz.build
+++ third_party/libwebrtc/call/payload_type_picker_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 c7fa9954fd8a..19c896a21aa4 100644
--- third_party/libwebrtc/call/receive_stream_interface_gn/moz.build
+++ third_party/libwebrtc/call/receive_stream_interface_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,123 +48,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":
 
@@ -165,50 +68,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 6fb2e359fbd9..20ac430288cf 100644
--- third_party/libwebrtc/call/rtp_interfaces_gn/moz.build
+++ third_party/libwebrtc/call/rtp_interfaces_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 2541c2cae1b1..824177307e7b 100644
--- third_party/libwebrtc/call/rtp_receiver_gn/moz.build
+++ third_party/libwebrtc/call/rtp_receiver_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("rtp_receiver_gn")
diff --git third_party/libwebrtc/call/rtp_sender_gn/moz.build third_party/libwebrtc/call/rtp_sender_gn/moz.build
index aa3c0bba6685..399904c3e24e 100644
--- third_party/libwebrtc/call/rtp_sender_gn/moz.build
+++ third_party/libwebrtc/call/rtp_sender_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("rtp_sender_gn")
diff --git third_party/libwebrtc/call/version_gn/moz.build third_party/libwebrtc/call/version_gn/moz.build
index e7398c80eac7..4eec2fd5233b 100644
--- third_party/libwebrtc/call/version_gn/moz.build
+++ third_party/libwebrtc/call/version_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 51f7c9ac299d..f5eea9cb37bc 100644
--- third_party/libwebrtc/call/video_receive_stream_api_gn/moz.build
+++ third_party/libwebrtc/call/video_receive_stream_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 0742e20b1bd4..f509a3a7a968 100644
--- third_party/libwebrtc/call/video_send_stream_api_gn/moz.build
+++ third_party/libwebrtc/call/video_send_stream_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 4c10d5cbee0e..8ba51fa2944b 100644
--- third_party/libwebrtc/common_audio/common_audio_avx2_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_avx2_gn/moz.build
@@ -17,12 +17,21 @@ CXXFLAGS += [
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_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("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 0707d29fb62f..76bf1b4c5a97 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,113 +48,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":
 
@@ -155,50 +68,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 d3ade0886cb0..1c75c3e95d87 100644
--- third_party/libwebrtc/common_audio/common_audio_c_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_c_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -80,114 +89,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",
@@ -195,25 +102,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",
@@ -224,7 +114,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"
@@ -241,8 +130,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",
@@ -257,88 +144,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",
@@ -346,13 +166,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",
@@ -360,14 +176,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 c023b7c150b1..b4d70cc2f54e 100644
--- third_party/libwebrtc/common_audio/common_audio_cc_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_cc_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 8a6ffa09aba0..3b2da1e0df87 100644
--- third_party/libwebrtc/common_audio/common_audio_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,190 +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
-
-    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 483307d5a1b8..cd818499ef51 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
@@ -12,12 +12,22 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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":
-
-    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 ef49252d158c..3986bf338e26 100644
--- third_party/libwebrtc/common_audio/common_audio_neon_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_neon_gn/moz.build
@@ -12,12 +12,22 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -45,148 +55,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 51912d444a2a..3cbf748ca212 100644
--- third_party/libwebrtc/common_audio/common_audio_sse2_gn/moz.build
+++ third_party/libwebrtc/common_audio/common_audio_sse2_gn/moz.build
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_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,156 +54,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 2e171bb7a6e1..2e23cff0927c 100644
--- third_party/libwebrtc/common_audio/fir_filter_factory_gn/moz.build
+++ third_party/libwebrtc/common_audio/fir_filter_factory_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 5ecdb1c5a628..1c7ccb98989b 100644
--- third_party/libwebrtc/common_audio/fir_filter_gn/moz.build
+++ third_party/libwebrtc/common_audio/fir_filter_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 7119bb2e4faf..2ddc2629d15a 100644
--- third_party/libwebrtc/common_audio/sinc_resampler_gn/moz.build
+++ third_party/libwebrtc/common_audio/sinc_resampler_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,123 +48,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":
 
@@ -165,50 +68,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 61b2490a0073..94878277903b 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,98 +52,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":
 
@@ -145,132 +63,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 78925ad820e1..93632857ca94 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 a6269cbd5a3f..7c59eb325f1f 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,115 +48,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"
     ]
@@ -156,7 +69,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"
@@ -164,8 +76,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"
     ]
@@ -176,102 +86,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 cb40e064282d..611b579b4f25 100644
--- third_party/libwebrtc/common_video/common_video_gn/moz.build
+++ third_party/libwebrtc/common_video/common_video_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 9cb9225a87fc..0db4ddb79920 100644
--- third_party/libwebrtc/common_video/corruption_detection_converters_gn/moz.build
+++ third_party/libwebrtc/common_video/corruption_detection_converters_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 fc3bafbb64b4..7581bd78b6c5 100644
--- third_party/libwebrtc/common_video/corruption_score_calculator_gn/moz.build
+++ third_party/libwebrtc/common_video/corruption_score_calculator_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 8fc0726fff58..9a2f65ea66c5 100644
--- third_party/libwebrtc/common_video/frame_counts_gn/moz.build
+++ third_party/libwebrtc/common_video/frame_counts_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 6f415251ad95..2e666f70cf8c 100644
--- third_party/libwebrtc/common_video/frame_instrumentation_data_gn/moz.build
+++ third_party/libwebrtc/common_video/frame_instrumentation_data_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 d36cf57dacd5..7652e895de75 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 2f940fd7bec3..b555230e9bce 100644
--- third_party/libwebrtc/dcsctp_gn/moz.build
+++ third_party/libwebrtc/dcsctp_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 216472255063..679a78a96f89 100644
--- third_party/libwebrtc/experiments/registered_field_trials_gn/moz.build
+++ third_party/libwebrtc/experiments/registered_field_trials_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 a6629977f400..0da1f97cbafd 100644
--- third_party/libwebrtc/logging/rtc_event_audio_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_audio_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 f5dbb588ce9d..aca9e63b106b 100644
--- third_party/libwebrtc/logging/rtc_event_bwe_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_bwe_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 f121198a0800..4a8b29c731a2 100644
--- third_party/libwebrtc/logging/rtc_event_field_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_field_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 2348f29e3310..7288ed35abad 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 524cb78d4918..ee2f0cd421d7 100644
--- third_party/libwebrtc/logging/rtc_event_number_encodings_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_number_encodings_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 6dc6484494da..824c9abdf3d0 100644
--- third_party/libwebrtc/logging/rtc_event_pacing_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_pacing_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 8cc1177e82ef..0ba912e5dbeb 100644
--- third_party/libwebrtc/logging/rtc_event_rtp_rtcp_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_rtp_rtcp_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 3f8e25f66cf1..5dfce62b3b3e 100644
--- third_party/libwebrtc/logging/rtc_event_video_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_event_video_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 604a99340ea1..abd1c123b85a 100644
--- third_party/libwebrtc/logging/rtc_stream_config_gn/moz.build
+++ third_party/libwebrtc/logging/rtc_stream_config_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 9cd35674dc77..bdfcd97c39a7 100644
--- third_party/libwebrtc/media/adapted_video_track_source_gn/moz.build
+++ third_party/libwebrtc/media/adapted_video_track_source_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 1241f267c6b3..c62c06c2e274 100644
--- third_party/libwebrtc/media/audio_source_gn/moz.build
+++ third_party/libwebrtc/media/audio_source_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 51c9e2fdf274..6123ce9afcd7 100644
--- third_party/libwebrtc/media/codec_gn/moz.build
+++ third_party/libwebrtc/media/codec_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("codec_gn")
diff --git third_party/libwebrtc/media/media_channel_gn/moz.build third_party/libwebrtc/media/media_channel_gn/moz.build
index 948e34ca808b..2b0ddb90290f 100644
--- third_party/libwebrtc/media/media_channel_gn/moz.build
+++ third_party/libwebrtc/media/media_channel_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,124 +48,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":
 
@@ -166,50 +68,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 fc55532a8011..52f88e43cc57 100644
--- third_party/libwebrtc/media/media_channel_impl_gn/moz.build
+++ third_party/libwebrtc/media/media_channel_impl_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 513ae136c7c4..423d08736d64 100644
--- third_party/libwebrtc/media/media_constants_gn/moz.build
+++ third_party/libwebrtc/media/media_constants_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 f2f90903dcce..5c5db0c2817b 100644
--- third_party/libwebrtc/media/media_engine_gn/moz.build
+++ third_party/libwebrtc/media/media_engine_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,124 +48,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":
 
@@ -166,50 +68,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 1985b87ded83..cc43c08f4956 100644
--- third_party/libwebrtc/media/rid_description_gn/moz.build
+++ third_party/libwebrtc/media/rid_description_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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("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 90168a773453..06a37c4a10e1 100644
--- third_party/libwebrtc/media/rtc_audio_video_gn/moz.build
+++ third_party/libwebrtc/media/rtc_audio_video_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["HAVE_WEBRTC_VIDEO"] = True
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,129 +54,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 += [
-        "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
+    DEFINES["WEBRTC_USE_PIPEWIRE"] = True
 
-if CONFIG["TARGET_CPU"] == "arm":
-
-    CXXFLAGS += [
-        "-mfpu=neon"
+    LOCAL_INCLUDES += [
+        "/third_party/pipewire/"
     ]
 
-    DEFINES["WEBRTC_ARCH_ARM"] = True
-    DEFINES["WEBRTC_ARCH_ARM_V7"] = True
-    DEFINES["WEBRTC_HAS_NEON"] = True
-
-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 += [
         "/third_party/pipewire/"
@@ -176,7 +79,6 @@ if CONFIG["TARGET_CPU"] == "mips32":
 if CONFIG["TARGET_CPU"] == "mips64":
 
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/third_party/pipewire/"
@@ -184,86 +86,28 @@ if CONFIG["TARGET_CPU"] == "mips64":
 
 if CONFIG["TARGET_CPU"] == "x86":
 
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_LIBS += [
-        "unwind"
-    ]
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
-
     CXXFLAGS += [
         "-msse2"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
-    DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-    LOCAL_INCLUDES += [
-        "/third_party/pipewire/"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/third_party/pipewire/"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    CXXFLAGS += [
-        "-msse2"
-    ]
+if CONFIG["TARGET_CPU"] == "x86_64":
 
+    DEFINES["WEBRTC_ENABLE_AVX2"] = True
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/third_party/pipewire/"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
-    LOCAL_INCLUDES += [
-        "/third_party/pipewire/"
-    ]
+    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 1adaccb51489..2c9bb96060fb 100644
--- third_party/libwebrtc/media/rtc_internal_video_codecs_gn/moz.build
+++ third_party/libwebrtc/media/rtc_internal_video_codecs_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -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_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 64266d40b4d4..a857149705a7 100644
--- third_party/libwebrtc/media/rtc_media_base_gn/moz.build
+++ third_party/libwebrtc/media/rtc_media_base_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,124 +48,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":
 
@@ -166,50 +68,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 1b6f1e5f819e..dd752363d357 100644
--- third_party/libwebrtc/media/rtc_media_config_gn/moz.build
+++ third_party/libwebrtc/media/rtc_media_config_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 d1ab590e0b6a..2a6276fa89f1 100644
--- third_party/libwebrtc/media/rtc_media_gn/moz.build
+++ third_party/libwebrtc/media/rtc_media_gn/moz.build
@@ -13,11 +13,20 @@ DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["HAVE_WEBRTC_VIDEO"] = True
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,128 +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",
-        "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":
 
@@ -171,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_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 1e630fef1e9c..fe3ca3871764 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 28bddfa3df6c..f610f31e77da 100644
--- third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build
+++ third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 fb6bf035b541..3de425bdbccc 100644
--- third_party/libwebrtc/media/rtp_utils_gn/moz.build
+++ third_party/libwebrtc/media/rtp_utils_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 fc9cfc7fec48..04e834b5bc39 100644
--- third_party/libwebrtc/media/stream_params_gn/moz.build
+++ third_party/libwebrtc/media/stream_params_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 01d68b1953aa..0ed1988aa44e 100644
--- third_party/libwebrtc/media/video_adapter_gn/moz.build
+++ third_party/libwebrtc/media/video_adapter_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 c009305537a3..f3a9666e381e 100644
--- third_party/libwebrtc/media/video_broadcaster_gn/moz.build
+++ third_party/libwebrtc/media/video_broadcaster_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 9fdf90d2eab1..157142b5b25e 100644
--- third_party/libwebrtc/media/video_common_gn/moz.build
+++ third_party/libwebrtc/media/video_common_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 98060ff1d3a0..81956c111ea3 100644
--- third_party/libwebrtc/media/video_source_base_gn/moz.build
+++ third_party/libwebrtc/media/video_source_base_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 fa5724cd7b6d..e5fc71a9fce0 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 942ca391253e..56ace0cdef4a 100644
--- third_party/libwebrtc/modules/audio_coding/audio_coding_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/audio_coding_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 722f61ffeb62..07bc360e04be 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 3179e363d16c..836cd7d4259d 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 29c2f1ad4f99..dfd43bdcc3ab 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 469146e9acdc..c23d12cc0979 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 520c1d24293a..d4173377c188 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 0093dc4e6a29..80b14354a709 100644
--- third_party/libwebrtc/modules/audio_coding/g711_c_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/g711_c_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 1883839bf2f6..5ea9245960d3 100644
--- third_party/libwebrtc/modules/audio_coding/g711_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/g711_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 e529107882e3..36607b5052fe 100644
--- third_party/libwebrtc/modules/audio_coding/g722_c_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/g722_c_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 1edb33c02700..7b6097e2aed1 100644
--- third_party/libwebrtc/modules/audio_coding/g722_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/g722_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 9b461b1c25af..48d6a8238c65 100644
--- third_party/libwebrtc/modules/audio_coding/isac_bwinfo_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/isac_bwinfo_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 4aa8ad903cb2..74726ce2c3fa 100644
--- third_party/libwebrtc/modules/audio_coding/isac_vad_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/isac_vad_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,175 +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
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 1dfa3e67f353..059cbe1c221b 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 08f8439eb07b..38c391c65bcd 100644
--- third_party/libwebrtc/modules/audio_coding/neteq_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/neteq_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -78,190 +87,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 1f357c4fb65d..0e172820621f 100644
--- third_party/libwebrtc/modules/audio_coding/pcm16b_c_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/pcm16b_c_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 3ea40d6df74d..437ca5438b62 100644
--- third_party/libwebrtc/modules/audio_coding/pcm16b_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/pcm16b_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 90cfee8f5214..8d208793ff79 100644
--- third_party/libwebrtc/modules/audio_coding/red_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/red_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 9a4452803747..1feff6421a4c 100644
--- third_party/libwebrtc/modules/audio_coding/webrtc_cng_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/webrtc_cng_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 62e6d99b0499..bb4eca518817 100644
--- third_party/libwebrtc/modules/audio_coding/webrtc_multiopus_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/webrtc_multiopus_gn/moz.build
@@ -12,13 +12,22 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_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,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("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 a540a00469f3..90011b5c16e2 100644
--- third_party/libwebrtc/modules/audio_coding/webrtc_opus_gn/moz.build
+++ third_party/libwebrtc/modules/audio_coding/webrtc_opus_gn/moz.build
@@ -12,13 +12,22 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_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,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("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 8970c596ba17..64721c4655fb 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
@@ -12,13 +12,22 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_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"
 
@@ -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("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 0bd773f44928..956114463750 100644
--- third_party/libwebrtc/modules/audio_device/audio_device_gn/moz.build
+++ third_party/libwebrtc/modules/audio_device/audio_device_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 ec77b35b94a4..b7a55333da6b 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 1a1300027eb4..c7a666de4c41 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 1f38d95be5ec..77161a5e662b 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
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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("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 5cf655eb9246..8b643a359c70 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 497676ffe622..fe1e34fdfc49 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,123 +48,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":
 
@@ -165,50 +68,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 ed02ca92381c..46c86f3568d0 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
@@ -17,13 +17,22 @@ CXXFLAGS += [
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -54,134 +63,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 3fb0ea8a2c6a..281b817e914c 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 4900eca9532f..b7ed821a08d2 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,123 +48,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":
 
@@ -165,50 +68,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 53b983a22fa7..45252f2e5ce8 100644
--- third_party/libwebrtc/modules/audio_processing/aec3/aec3_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/aec3/aec3_gn/moz.build
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -100,190 +109,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 5310e43a1d89..0c9cc569430d 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 16305e915fb6..433d161cb781 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 107439b1d3d8..ee2869af9930 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 727984504717..8420c2a67ee0 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 2fa8e61caaf6..2426c14c0008 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 f4a57f1fbac8..b3959e4726fd 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 6196d6ff4ff0..91b70f2ef1b6 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 a884cffa8f5f..2d6f110d04dc 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,114 +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"
-    ]
-
-    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":
 
@@ -159,27 +61,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"
     ]
@@ -188,7 +75,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"
@@ -196,8 +82,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"
     ]
@@ -208,90 +92,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 c456275f855a..ac4803f3488f 100644
--- third_party/libwebrtc/modules/audio_processing/agc/agc_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc/agc_gn/moz.build
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -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("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 456421e167ea..e18a5ed5f14e 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 ab1285e34d37..38bee0b95eaa 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 14e35c2e0246..bacac4da045d 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 a926bba44729..ec062dd8dcca 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
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -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("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 2ccf23b32856..4c4aea313a76 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 b7bfe444b7fb..978fca187767 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 138354dbc46a..1d1718c4a270 100644
--- third_party/libwebrtc/modules/audio_processing/agc2/common_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/agc2/common_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 2f40304afaee..50c4819481af 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 f5c615e7c144..edbdcc79c315 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
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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("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 336fbad968e3..16bd1dcb8f4d 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 a542386830ea..205ef2fa8610 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 f5be716a8bc5..a953fa94c99a 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
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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("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 feb82f3997c9..d06082663d6a 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 e90d9910bf62..82e5e8f4333b 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
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -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("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 24079e9ae6d1..171732e1f557 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 49c7c7762c63..32c5af366c7d 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,123 +48,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":
 
@@ -165,50 +68,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 26a7d3b891a7..696f0ee96b59 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 04a1e7cc555a..413755876901 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 98019531c7f9..58978d7f3e35 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 7d650f259e13..56c167cc8561 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 0eb74a400fb0..4591b6d57ed8 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 2df8bb1943ed..0fa750093bb2 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 be92010f91fa..4936229921d9 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 709fac2fabc4..0976324eb70d 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 b24d7b4742f2..c956363856eb 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
@@ -17,12 +17,21 @@ CXXFLAGS += [
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_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"
 
@@ -49,134 +58,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 edc37cfec66d..8420c2a67ee0 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,123 +48,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":
 
@@ -165,50 +68,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 d71b31c270e2..795d8ebb9737 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
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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("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 1e8ce8cdd78c..c87eec7a75bd 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
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -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("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 ef605c387ad5..5c95e03997df 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 f74ce8a70dc4..5be7419cee20 100644
--- third_party/libwebrtc/modules/audio_processing/apm_logging_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/apm_logging_gn/moz.build
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -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("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 17db8ead56a7..bd926084a6ce 100644
--- third_party/libwebrtc/modules/audio_processing/audio_buffer_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/audio_buffer_gn/moz.build
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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("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 8c5816304747..a21ed67082b0 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 f011e41ad837..cd71f405e9a4 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 95c38f0a6293..bf2444058ce4 100644
--- third_party/libwebrtc/modules/audio_processing/audio_processing_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/audio_processing_gn/moz.build
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -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("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 bfb581bfc19a..057ed5008fe2 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 04d5bf230b3e..4190f76f185c 100644
--- third_party/libwebrtc/modules/audio_processing/gain_controller2_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/gain_controller2_gn/moz.build
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -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("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 d8f32b688d0b..44c2749058fa 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 cdb283be4f2b..4d8edc876b34 100644
--- third_party/libwebrtc/modules/audio_processing/ns/ns_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/ns/ns_gn/moz.build
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -56,190 +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
-
-    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 35578fe55223..5cec24215df9 100644
--- third_party/libwebrtc/modules/audio_processing/rms_level_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/rms_level_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 21cda458a6ce..cc9aa8a23789 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 f3d2ab4734e6..334ae5fcb19e 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 f56c3da34118..614e69397e87 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 bbef9ef6246b..970ceced4e0c 100644
--- third_party/libwebrtc/modules/audio_processing/vad/vad_gn/moz.build
+++ third_party/libwebrtc/modules/audio_processing/vad/vad_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 4389423238bc..539536626c14 100644
--- third_party/libwebrtc/modules/congestion_controller/congestion_controller_gn/moz.build
+++ third_party/libwebrtc/modules/congestion_controller/congestion_controller_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 c4ea2411dd35..00d812745382 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 b6288b8b9dba..b299425379f1 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 7b91bffbc132..c7ad21c9a567 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 31f5270f937c..252a984262aa 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 d34cc09be9ab..809519d72971 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 6be492d21600..50730ce0d2ae 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 cc47dffd8409..faba241a563f 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 342ac79b6a57..f22d4ec35dad 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 b04648d2b179..011e410cf1ee 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 fd539cda7a7c..c8199d07d582 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 d749ed805f5f..66924e80dc84 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 28fb2063158d..b1b80eca85cc 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 9cbeb68d6f40..0feadf987590 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
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_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"
 
@@ -44,111 +53,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 60ff9cd6526d..c14bbe8d54c3 100644
--- third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build
+++ third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build
@@ -14,11 +14,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -70,186 +79,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/",
@@ -262,7 +98,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 += [
@@ -272,36 +109,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":
@@ -309,7 +119,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/",
@@ -322,7 +131,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 += [
@@ -332,13 +142,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/",
@@ -351,7 +162,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 += [
@@ -361,126 +173,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/drm/drm/",
-        "/third_party/drm/drm/include/",
-        "/third_party/drm/drm/include/libdrm/",
-        "/third_party/gbm/gbm/",
-        "/third_party/libepoxy/libepoxy/include/",
-        "/third_party/pipewire/"
-    ]
-
-    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/",
@@ -493,7 +198,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 += [
@@ -503,13 +209,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/",
@@ -522,7 +230,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 += [
@@ -532,10 +241,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
@@ -563,144 +274,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":
-
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_USE_X11"] = True
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "loongarch64":
 
-    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":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD" and CONFIG["TARGET_CPU"] == "ppc64":
 
-    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"] == "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 a8051a1743d1..000000000000
--- third_party/libwebrtc/modules/desktop_capture/desktop_capture_objc_gn/moz.build
+++ /dev/null
@@ -1,79 +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["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 6795abb4c898..4b4aca6ade46 100644
--- third_party/libwebrtc/modules/desktop_capture/primitives_gn/moz.build
+++ third_party/libwebrtc/modules/desktop_capture/primitives_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,171 +58,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 60c0ed877863..ab93d8e54775 100644
--- third_party/libwebrtc/modules/module_api_gn/moz.build
+++ third_party/libwebrtc/modules/module_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 2c28b0b1c0ff..b0af3d0bc389 100644
--- third_party/libwebrtc/modules/module_api_public_gn/moz.build
+++ third_party/libwebrtc/modules/module_api_public_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 a1eca74eaad1..f8b949dcfe2c 100644
--- third_party/libwebrtc/modules/module_fec_api_gn/moz.build
+++ third_party/libwebrtc/modules/module_fec_api_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 0300737e26a4..c22978c6f96c 100644
--- third_party/libwebrtc/modules/pacing/interval_budget_gn/moz.build
+++ third_party/libwebrtc/modules/pacing/interval_budget_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 484e8af1dfc6..70e970c7d0ce 100644
--- third_party/libwebrtc/modules/pacing/pacing_gn/moz.build
+++ third_party/libwebrtc/modules/pacing/pacing_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("pacing_gn")
diff --git third_party/libwebrtc/modules/portal/portal_gn/moz.build third_party/libwebrtc/modules/portal/portal_gn/moz.build
index 350aa34cf13c..33c52d953465 100644
--- third_party/libwebrtc/modules/portal/portal_gn/moz.build
+++ third_party/libwebrtc/modules/portal/portal_gn/moz.build
@@ -14,21 +14,17 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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
@@ -75,16 +71,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
@@ -102,7 +88,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 01de5cae11d8..701fdd16c845 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 4047187d2640..b11ca0609ad3 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,190 +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 += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 81ce4981cd66..f8ce7a164c83 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,123 +48,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":
 
@@ -165,50 +68,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 aeea39d87702..b6549d94ffe7 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 2af40d70ebee..f5a2c0675194 100644
--- third_party/libwebrtc/modules/rtp_rtcp/leb128_gn/moz.build
+++ third_party/libwebrtc/modules/rtp_rtcp/leb128_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 7fd7cad470d6..b6e083c4dd5f 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 55763bfa6b82..04b0635746d7 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -87,190 +96,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 b0c5446ca7be..829a5495c9a4 100644
--- third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_gn/moz.build
+++ third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -97,191 +106,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 ac0783597427..6dc16af33610 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 0d6fa06ae4ab..7e457e9c7fff 100644
--- third_party/libwebrtc/modules/third_party/fft/fft_gn/moz.build
+++ third_party/libwebrtc/modules/third_party/fft/fft_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 212ac260ac44..0148ce7f583f 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 4058bb9c623b..7d993f90b813 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("g722_3p_gn")
diff --git third_party/libwebrtc/modules/utility/utility_gn/moz.build third_party/libwebrtc/modules/utility/utility_gn/moz.build
index ff98afc45031..0bdce0baa056 100644
--- third_party/libwebrtc/modules/utility/utility_gn/moz.build
+++ third_party/libwebrtc/modules/utility/utility_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,116 +48,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":
 
@@ -158,60 +68,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 2e93aea47676..2be170137cf5 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
@@ -14,11 +14,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,6 +42,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"
 ]
 
@@ -45,153 +58,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/",
@@ -210,76 +83,11 @@ if CONFIG["TARGET_CPU"] == "mips32":
         "/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/",
-        "/third_party/drm/drm/",
-        "/third_party/drm/drm/include/",
-        "/third_party/drm/drm/include/libdrm/",
-        "/third_party/gbm/gbm/",
-        "/third_party/libepoxy/libepoxy/include/",
-        "/third_party/pipewire/"
-    ]
-
-    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"] == "x86":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
-    OS_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/",
@@ -298,10 +106,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/",
@@ -320,14 +127,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/",
@@ -346,10 +153,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/",
@@ -368,4 +175,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 8eb64eb08f2b..7df621b28fa4 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 5937538364f0..f620f14e0914 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 0e376beeb43f..5b2293a8c2a6 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 fada35453906..bd504c7f3aab 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 24fa539a5cab..a188413dc48b 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
@@ -15,11 +15,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,186 +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
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 24ceefe34957..eff195ec2131 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
@@ -15,11 +15,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 e58cb936c199..6782dfdfe553 100644
--- third_party/libwebrtc/modules/video_coding/encoded_frame_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/encoded_frame_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 0f2412610dbf..e5bb732bbb88 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 60b5c7b7ece6..61c30cb5584e 100644
--- third_party/libwebrtc/modules/video_coding/frame_helpers_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/frame_helpers_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 ade14f4e1b82..533519d32835 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 011e05c41a35..4c0a79157158 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 bdb63a278c1a..876704e1108a 100644
--- third_party/libwebrtc/modules/video_coding/nack_requester_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/nack_requester_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 cceabc3a79be..10def6584884 100644
--- third_party/libwebrtc/modules/video_coding/packet_buffer_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/packet_buffer_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 bc20befd0715..899b8b26696b 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 a16034b3b02e..d6ba49e4f848 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,186 +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
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 1217d027bd0c..be3d0562194c 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 1c9b143c6d78..c542cfb06869 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 1f4d5e0258d8..0c39b0372a4c 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 a1f79bc336d3..46a3f3c27eb7 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 236158a0edad..cede417ed2c0 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 46b966db475b..e680f19b417f 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 e5ab643a0837..3956e5fb7141 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 018a8b4baf38..e8117da97d09 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 6b0a5bd11fe1..62189b4f8b6f 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 2c399005d50a..73a1afbc3010 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 5f424f15c3eb..43a9bb659cbc 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 f12701855e1a..04bb63314cc3 100644
--- third_party/libwebrtc/modules/video_coding/video_coding_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/video_coding_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 51f84c774238..c7cad0188c20 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,191 +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 += [
-        "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 c67f86066d95..2c584fade5d5 100644
--- third_party/libwebrtc/modules/video_coding/webrtc_h264_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/webrtc_h264_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,191 +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 += [
-        "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 9272a224c583..aa55521fb1a8 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
@@ -15,11 +15,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 aea179a464fa..91d251da69da 100644
--- third_party/libwebrtc/modules/video_coding/webrtc_vp8_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/webrtc_vp8_gn/moz.build
@@ -15,11 +15,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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_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 1e543688ce0a..f599b8e6fe2c 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 76d68e59a807..7bcdfba72a3d 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,191 +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 += [
-        "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 d807360bfdb9..69fea357b30b 100644
--- third_party/libwebrtc/modules/video_coding/webrtc_vp9_gn/moz.build
+++ third_party/libwebrtc/modules/video_coding/webrtc_vp9_gn/moz.build
@@ -15,11 +15,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 a734c18d2ccf..42f79acec164 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 fb93b2ab5309..08ce55822bf1 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,102 +519,11 @@ 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/drm/drm_gn",
         "/third_party/libwebrtc/third_party/gbm/gbm_gn",
@@ -620,26 +531,19 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
         "/third_party/libwebrtc/third_party/pipewire/pipewire_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/drm/drm_gn",
         "/third_party/libwebrtc/third_party/gbm/gbm_gn",
         "/third_party/libwebrtc/third_party/libepoxy/libepoxy_gn",
         "/third_party/libwebrtc/third_party/pipewire/pipewire_gn"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "mips32":
+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/drm/drm_gn",
         "/third_party/libwebrtc/third_party/gbm/gbm_gn",
@@ -647,19 +551,7 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "mips32":
         "/third_party/libwebrtc/third_party/pipewire/pipewire_gn"
     ]
 
-if CONFIG["OS_TARGET"] == "Linux" 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/drm/drm_gn",
-        "/third_party/libwebrtc/third_party/gbm/gbm_gn",
-        "/third_party/libwebrtc/third_party/libepoxy/libepoxy_gn",
-        "/third_party/libwebrtc/third_party/pipewire/pipewire_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",
@@ -667,8 +559,6 @@ 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/drm/drm_gn",
         "/third_party/libwebrtc/third_party/gbm/gbm_gn",
@@ -676,7 +566,7 @@ if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
         "/third_party/libwebrtc/third_party/pipewire/pipewire_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",
@@ -684,76 +574,9 @@ 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/drm/drm_gn",
         "/third_party/libwebrtc/third_party/gbm/gbm_gn",
         "/third_party/libwebrtc/third_party/libepoxy/libepoxy_gn",
         "/third_party/libwebrtc/third_party/pipewire/pipewire_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 eca892f4b02e..c528241420bd 100644
--- third_party/libwebrtc/net/dcsctp/common/internal_types_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/common/internal_types_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 31a8282c2e53..bf7cde0c5a6b 100644
--- third_party/libwebrtc/net/dcsctp/common/math_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/common/math_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 a846f1a0d33d..4c0fce5d6266 100644
--- third_party/libwebrtc/net/dcsctp/common/sequence_numbers_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/common/sequence_numbers_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 afa02fd16c4f..6b6ba69cc8b2 100644
--- third_party/libwebrtc/net/dcsctp/packet/bounded_io_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/bounded_io_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 0b444ee87f8f..0b6864a3f398 100644
--- third_party/libwebrtc/net/dcsctp/packet/chunk_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/chunk_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -60,186 +69,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 98062c27066e..c19e934effcf 100644
--- third_party/libwebrtc/net/dcsctp/packet/chunk_validators_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/chunk_validators_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 70f2f245242b..6db407d3c392 100644
--- third_party/libwebrtc/net/dcsctp/packet/crc32c_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/crc32c_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 7ecb713c4107..a7bee1d658c9 100644
--- third_party/libwebrtc/net/dcsctp/packet/data_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/data_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 6a16d627ed56..a4c0982bd786 100644
--- third_party/libwebrtc/net/dcsctp/packet/error_cause_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/error_cause_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 4502dede2e9a..0735d8a5c65b 100644
--- third_party/libwebrtc/net/dcsctp/packet/parameter_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/parameter_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 3b65e2e1c551..1033c5c1c02c 100644
--- third_party/libwebrtc/net/dcsctp/packet/sctp_packet_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/sctp_packet_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 7760bdab3371..785c32caee3d 100644
--- third_party/libwebrtc/net/dcsctp/packet/tlv_trait_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/packet/tlv_trait_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 d5c44cd7f55d..8130510f9f5c 100644
--- third_party/libwebrtc/net/dcsctp/public/factory_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/public/factory_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 17e62497fbfd..e972e6822983 100644
--- third_party/libwebrtc/net/dcsctp/public/socket_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/public/socket_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 b7af89b0851d..0a2272a27689 100644
--- third_party/libwebrtc/net/dcsctp/public/types_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/public/types_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 ed06ee415f8e..312e54212c64 100644
--- third_party/libwebrtc/net/dcsctp/rx/data_tracker_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/rx/data_tracker_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 7db6319dfaa8..ed90dc7cc461 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 efa360452257..befef0bbe4f5 100644
--- third_party/libwebrtc/net/dcsctp/rx/reassembly_queue_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/rx/reassembly_queue_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 b829e624d36a..6363d35c7972 100644
--- third_party/libwebrtc/net/dcsctp/rx/reassembly_streams_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/rx/reassembly_streams_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 f8e03b62eb88..c410a12e3122 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 d6ae65b02e63..5c343e4e3e30 100644
--- third_party/libwebrtc/net/dcsctp/socket/context_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/socket/context_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 5077ef17d6e3..afac7802f8e3 100644
--- third_party/libwebrtc/net/dcsctp/socket/dcsctp_socket_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/socket/dcsctp_socket_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 754c30dabf4b..43c70d03ca46 100644
--- third_party/libwebrtc/net/dcsctp/socket/heartbeat_handler_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/socket/heartbeat_handler_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 4473e5cdb86d..ef16a31312b8 100644
--- third_party/libwebrtc/net/dcsctp/socket/packet_sender_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/socket/packet_sender_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 f740f1e2814a..66d5e7387bb3 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 2f57383eed74..ab7a50de0e71 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 92d96b5a4884..b8f118fa70e9 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 e72d318f368b..5e9b0f5f076e 100644
--- third_party/libwebrtc/net/dcsctp/timer/timer_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/timer/timer_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 db4877c0eb5a..bee7fe1717f9 100644
--- third_party/libwebrtc/net/dcsctp/tx/outstanding_data_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/tx/outstanding_data_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 1d65b2c48361..633445df7694 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 7b314599a9ba..1b8bec53706d 100644
--- third_party/libwebrtc/net/dcsctp/tx/retransmission_queue_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/tx/retransmission_queue_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 65d68e087729..c5164b6718d3 100644
--- third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/tx/retransmission_timeout_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 1cb8bd431eaa..9ea25738de8c 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 103522c30ecf..f78f753430a9 100644
--- third_party/libwebrtc/net/dcsctp/tx/send_queue_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/tx/send_queue_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 1617cd052cfb..1918ce77f1a0 100644
--- third_party/libwebrtc/net/dcsctp/tx/stream_scheduler_gn/moz.build
+++ third_party/libwebrtc/net/dcsctp/tx/stream_scheduler_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 07281aa318a7..2a5a0f61c3c3 100644
--- third_party/libwebrtc/rtc_base/async_dns_resolver_gn/moz.build
+++ third_party/libwebrtc/rtc_base/async_dns_resolver_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,187 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 59de36d84d9a..1dc426614ba0 100644
--- third_party/libwebrtc/rtc_base/async_packet_socket_gn/moz.build
+++ third_party/libwebrtc/rtc_base/async_packet_socket_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 2bb40d7b400d..59b686b72228 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 a97cbd0f0e4b..a183036f9f29 100644
--- third_party/libwebrtc/rtc_base/bit_buffer_gn/moz.build
+++ third_party/libwebrtc/rtc_base/bit_buffer_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 48ec1d8b394a..bb90b19b5ef7 100644
--- third_party/libwebrtc/rtc_base/bitrate_tracker_gn/moz.build
+++ third_party/libwebrtc/rtc_base/bitrate_tracker_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 b6e5cdc25679..f2785c8a470b 100644
--- third_party/libwebrtc/rtc_base/bitstream_reader_gn/moz.build
+++ third_party/libwebrtc/rtc_base/bitstream_reader_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 cb8c70cd12d1..627182b344f7 100644
--- third_party/libwebrtc/rtc_base/buffer_gn/moz.build
+++ third_party/libwebrtc/rtc_base/buffer_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 53412c151689..d57286760dc5 100644
--- third_party/libwebrtc/rtc_base/byte_buffer_gn/moz.build
+++ third_party/libwebrtc/rtc_base/byte_buffer_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 eb8960e92dc5..b483351cb849 100644
--- third_party/libwebrtc/rtc_base/byte_order_gn/moz.build
+++ third_party/libwebrtc/rtc_base/byte_order_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 4009fff6361f..bac79efc3909 100644
--- third_party/libwebrtc/rtc_base/checks_gn/moz.build
+++ third_party/libwebrtc/rtc_base/checks_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 758670919dc9..e20bdf1570ff 100644
--- third_party/libwebrtc/rtc_base/compile_assert_c_gn/moz.build
+++ third_party/libwebrtc/rtc_base/compile_assert_c_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 29e2f794070b..0e1ee33fb9d3 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 9bdb5b2ad824..55eff7cde666 100644
--- third_party/libwebrtc/rtc_base/containers/flat_map_gn/moz.build
+++ third_party/libwebrtc/rtc_base/containers/flat_map_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 43ac4165fbd2..051e2d72bb5c 100644
--- third_party/libwebrtc/rtc_base/containers/flat_set_gn/moz.build
+++ third_party/libwebrtc/rtc_base/containers/flat_set_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 d35d1ab479c6..f01886085505 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 544b3575f3af..1f93cdc117ab 100644
--- third_party/libwebrtc/rtc_base/criticalsection_gn/moz.build
+++ third_party/libwebrtc/rtc_base/criticalsection_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 013c8ff94548..1156dc035fd3 100644
--- third_party/libwebrtc/rtc_base/divide_round_gn/moz.build
+++ third_party/libwebrtc/rtc_base/divide_round_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 8e779b7743dd..21675b22576d 100644
--- third_party/libwebrtc/rtc_base/dscp_gn/moz.build
+++ third_party/libwebrtc/rtc_base/dscp_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 411fcbcd72da..cee2e6eedbcc 100644
--- third_party/libwebrtc/rtc_base/event_tracer_gn/moz.build
+++ third_party/libwebrtc/rtc_base/event_tracer_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 84ed89ed87e1..42435f27ca55 100644
--- third_party/libwebrtc/rtc_base/experiments/alr_experiment_gn/moz.build
+++ third_party/libwebrtc/rtc_base/experiments/alr_experiment_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 c9d63e7c296f..effe36e6b677 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 3fe445b45d51..a50e956523c8 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 139b64b3d998..1072fbd432a0 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 08398c40cf56..c1357e5111db 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 d8b7892933f0..bc080f3f2b04 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 7e7af322ca00..248222fdb89c 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 2ffaf07d5cea..96c027f57661 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 bc0db9b773f9..f3dc32a385fe 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 6c3dc1ed384f..e704571afe9c 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 a96bdf65536e..5a0edcd1347a 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 fd45f36c268e..74059151d385 100644
--- third_party/libwebrtc/rtc_base/frequency_tracker_gn/moz.build
+++ third_party/libwebrtc/rtc_base/frequency_tracker_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 b4199a311652..d1a4f3caee83 100644
--- third_party/libwebrtc/rtc_base/gtest_prod_gn/moz.build
+++ third_party/libwebrtc/rtc_base/gtest_prod_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 e235da2187aa..7c1c2ed4eca6 100644
--- third_party/libwebrtc/rtc_base/histogram_percentile_counter_gn/moz.build
+++ third_party/libwebrtc/rtc_base/histogram_percentile_counter_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 bc2ed633f802..000000000000
--- third_party/libwebrtc/rtc_base/ifaddrs_android_gn/moz.build
+++ /dev/null
@@ -1,94 +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["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 a3761c664470..267e43801deb 100644
--- third_party/libwebrtc/rtc_base/ignore_wundef_gn/moz.build
+++ third_party/libwebrtc/rtc_base/ignore_wundef_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 8591a3b9be6c..d5a8d4cae0ef 100644
--- third_party/libwebrtc/rtc_base/ip_address_gn/moz.build
+++ third_party/libwebrtc/rtc_base/ip_address_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 0121355ea171..448a2e06255a 100644
--- third_party/libwebrtc/rtc_base/logging_gn/moz.build
+++ third_party/libwebrtc/rtc_base/logging_gn/moz.build
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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"
 
@@ -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("logging_gn")
diff --git third_party/libwebrtc/rtc_base/macromagic_gn/moz.build third_party/libwebrtc/rtc_base/macromagic_gn/moz.build
index fb0141f9992f..dd3d584195c0 100644
--- third_party/libwebrtc/rtc_base/macromagic_gn/moz.build
+++ third_party/libwebrtc/rtc_base/macromagic_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 1965f7ec53af..c2362607b3f3 100644
--- third_party/libwebrtc/rtc_base/memory/aligned_malloc_gn/moz.build
+++ third_party/libwebrtc/rtc_base/memory/aligned_malloc_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 1b552f64a772..2890fedddb9a 100644
--- third_party/libwebrtc/rtc_base/mod_ops_gn/moz.build
+++ third_party/libwebrtc/rtc_base/mod_ops_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 c3715c2c6b20..12388acab2b4 100644
--- third_party/libwebrtc/rtc_base/moving_max_counter_gn/moz.build
+++ third_party/libwebrtc/rtc_base/moving_max_counter_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 33488c655174..ead57cd08a32 100644
--- third_party/libwebrtc/rtc_base/net_helpers_gn/moz.build
+++ third_party/libwebrtc/rtc_base/net_helpers_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 6c4cd224b98b..bc515fc5c103 100644
--- third_party/libwebrtc/rtc_base/network/ecn_marking_gn/moz.build
+++ third_party/libwebrtc/rtc_base/network/ecn_marking_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 04b51f0502b3..abba0d8decc4 100644
--- third_party/libwebrtc/rtc_base/network/sent_packet_gn/moz.build
+++ third_party/libwebrtc/rtc_base/network/sent_packet_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 b8fb244a8e99..a93a94841ac8 100644
--- third_party/libwebrtc/rtc_base/network_constants_gn/moz.build
+++ third_party/libwebrtc/rtc_base/network_constants_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 2f552b99a2ba..3a16933c8e3d 100644
--- third_party/libwebrtc/rtc_base/network_route_gn/moz.build
+++ third_party/libwebrtc/rtc_base/network_route_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 c07ee42a4768..ca7dd6bb37c7 100644
--- third_party/libwebrtc/rtc_base/null_socket_server_gn/moz.build
+++ third_party/libwebrtc/rtc_base/null_socket_server_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,187 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 11bbb05fa7c9..9ef0efeb1338 100644
--- third_party/libwebrtc/rtc_base/one_time_event_gn/moz.build
+++ third_party/libwebrtc/rtc_base/one_time_event_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 945e2783d6ef..a541e3b4d5a2 100644
--- third_party/libwebrtc/rtc_base/platform_thread_gn/moz.build
+++ third_party/libwebrtc/rtc_base/platform_thread_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 48c27d813e17..f23aca8108e2 100644
--- third_party/libwebrtc/rtc_base/platform_thread_types_gn/moz.build
+++ third_party/libwebrtc/rtc_base/platform_thread_types_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 668f1d0a980d..4d3ef5564a90 100644
--- third_party/libwebrtc/rtc_base/protobuf_utils_gn/moz.build
+++ third_party/libwebrtc/rtc_base/protobuf_utils_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 6d2ee3c0a0b4..6deeed359a2b 100644
--- third_party/libwebrtc/rtc_base/race_checker_gn/moz.build
+++ third_party/libwebrtc/rtc_base/race_checker_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 38d713e123cd..70cddc604dc3 100644
--- third_party/libwebrtc/rtc_base/random_gn/moz.build
+++ third_party/libwebrtc/rtc_base/random_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 8827194a0ddc..2ca7defd349f 100644
--- third_party/libwebrtc/rtc_base/rate_limiter_gn/moz.build
+++ third_party/libwebrtc/rtc_base/rate_limiter_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 88038145cf15..98328fad3324 100644
--- third_party/libwebrtc/rtc_base/rate_statistics_gn/moz.build
+++ third_party/libwebrtc/rtc_base/rate_statistics_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 bd0629bfa0db..dce869f89476 100644
--- third_party/libwebrtc/rtc_base/rate_tracker_gn/moz.build
+++ third_party/libwebrtc/rtc_base/rate_tracker_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 3595a7a13a2b..b23b29b3df2a 100644
--- third_party/libwebrtc/rtc_base/refcount_gn/moz.build
+++ third_party/libwebrtc/rtc_base/refcount_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 daf579df3533..f83bf4191a50 100644
--- third_party/libwebrtc/rtc_base/rolling_accumulator_gn/moz.build
+++ third_party/libwebrtc/rtc_base/rolling_accumulator_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 f01e48e21375..61236b44fa64 100644
--- third_party/libwebrtc/rtc_base/rtc_event_gn/moz.build
+++ third_party/libwebrtc/rtc_base/rtc_event_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 9c7b0c6d3f55..a11937d5e09e 100644
--- third_party/libwebrtc/rtc_base/rtc_numerics_gn/moz.build
+++ third_party/libwebrtc/rtc_base/rtc_numerics_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 80d295aa9d5d..5674190b8fd3 100644
--- third_party/libwebrtc/rtc_base/safe_compare_gn/moz.build
+++ third_party/libwebrtc/rtc_base/safe_compare_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 c9b97cb7ed49..614a50cc3677 100644
--- third_party/libwebrtc/rtc_base/safe_conversions_gn/moz.build
+++ third_party/libwebrtc/rtc_base/safe_conversions_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 50e6173fccd3..dd120fb85232 100644
--- third_party/libwebrtc/rtc_base/safe_minmax_gn/moz.build
+++ third_party/libwebrtc/rtc_base/safe_minmax_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 4ffa48a120cb..5a19758cd0c1 100644
--- third_party/libwebrtc/rtc_base/sample_counter_gn/moz.build
+++ third_party/libwebrtc/rtc_base/sample_counter_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 a860a9f7282b..65d7a7b001cc 100644
--- third_party/libwebrtc/rtc_base/sanitizer_gn/moz.build
+++ third_party/libwebrtc/rtc_base/sanitizer_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 04cba77cbb9c..b2c6204e306f 100644
--- third_party/libwebrtc/rtc_base/socket_address_gn/moz.build
+++ third_party/libwebrtc/rtc_base/socket_address_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,187 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 f3356c04b441..591ac160c8cb 100644
--- third_party/libwebrtc/rtc_base/socket_factory_gn/moz.build
+++ third_party/libwebrtc/rtc_base/socket_factory_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,120 +48,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":
 
@@ -162,50 +68,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 edca3916c141..483f18116d82 100644
--- third_party/libwebrtc/rtc_base/socket_gn/moz.build
+++ third_party/libwebrtc/rtc_base/socket_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,187 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 942e81926f06..b2c9e653415f 100644
--- third_party/libwebrtc/rtc_base/socket_server_gn/moz.build
+++ third_party/libwebrtc/rtc_base/socket_server_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,120 +48,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":
 
@@ -162,50 +68,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 75ac6a6be25d..61f586516d9a 100644
--- third_party/libwebrtc/rtc_base/ssl_adapter_gn/moz.build
+++ third_party/libwebrtc/rtc_base/ssl_adapter_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 e3472674ceed..75f5872592d6 100644
--- third_party/libwebrtc/rtc_base/ssl_gn/moz.build
+++ third_party/libwebrtc/rtc_base/ssl_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 3a9379a6bc47..5c8050faccb3 100644
--- third_party/libwebrtc/rtc_base/stringutils_gn/moz.build
+++ third_party/libwebrtc/rtc_base/stringutils_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 f095e4d464fa..1d1169bf8b1c 100644
--- third_party/libwebrtc/rtc_base/strong_alias_gn/moz.build
+++ third_party/libwebrtc/rtc_base/strong_alias_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 3fc5f7cf3ddc..f8f4f5f791c7 100644
--- third_party/libwebrtc/rtc_base/swap_queue_gn/moz.build
+++ third_party/libwebrtc/rtc_base/swap_queue_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 ba727290af65..0b02cb2f3fe4 100644
--- third_party/libwebrtc/rtc_base/synchronization/mutex_gn/moz.build
+++ third_party/libwebrtc/rtc_base/synchronization/mutex_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 570234e8e2b0..ca17fd6c0ab5 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 662dc4ca7ae1..197cc9f03ae6 100644
--- third_party/libwebrtc/rtc_base/synchronization/yield_gn/moz.build
+++ third_party/libwebrtc/rtc_base/synchronization/yield_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 45cb36beecd3..32deffc163e4 100644
--- third_party/libwebrtc/rtc_base/synchronization/yield_policy_gn/moz.build
+++ third_party/libwebrtc/rtc_base/synchronization/yield_policy_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 c3db5cb3ded8..a2e813fa095d 100644
--- third_party/libwebrtc/rtc_base/system/arch_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/arch_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 89f37a5264ae..000000000000
--- third_party/libwebrtc/rtc_base/system/asm_defines_gn/moz.build
+++ /dev/null
@@ -1,79 +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["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 558f19324d33..000000000000
--- third_party/libwebrtc/rtc_base/system/cocoa_threading_gn/moz.build
+++ /dev/null
@@ -1,67 +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["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 c5dee909a263..f7eba12a6be4 100644
--- third_party/libwebrtc/rtc_base/system/file_wrapper_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/file_wrapper_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 ebb3552a5504..000000000000
--- third_party/libwebrtc/rtc_base/system/gcd_helpers_gn/moz.build
+++ /dev/null
@@ -1,67 +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["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 5d57390d5397..b48a3638292c 100644
--- third_party/libwebrtc/rtc_base/system/ignore_warnings_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/ignore_warnings_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 a7d22c9d0e49..4a835c05d986 100644
--- third_party/libwebrtc/rtc_base/system/inline_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/inline_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 790097730f5b..c2c0856a03a4 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 5fc704343e06..c60c915ab864 100644
--- third_party/libwebrtc/rtc_base/system/rtc_export_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/rtc_export_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 f7b9e968bc50..55dff7ae76d6 100644
--- third_party/libwebrtc/rtc_base/system/unused_gn/moz.build
+++ third_party/libwebrtc/rtc_base/system/unused_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 5fcc0bfdb857..4a52fef8ab31 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 7cf1e2075a0f..e4e1313c11ac 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 6450a0f93d9c..17a7e7e1fd02 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 c49d14388071..0ffbd2fcb7c5 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 e7736326f899..f9660eb3f4bf 100644
--- third_party/libwebrtc/rtc_base/threading_gn/moz.build
+++ third_party/libwebrtc/rtc_base/threading_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,203 +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"
-    ]
-
-    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 d0e0c964838e..b0b2d2ee8d11 100644
--- third_party/libwebrtc/rtc_base/timeutils_gn/moz.build
+++ third_party/libwebrtc/rtc_base/timeutils_gn/moz.build
@@ -12,12 +12,21 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 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"
 
@@ -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("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 53e285beefd0..3eaba3fb643a 100644
--- third_party/libwebrtc/rtc_base/type_traits_gn/moz.build
+++ third_party/libwebrtc/rtc_base/type_traits_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 20c6f058f674..8adce8dc7f84 100644
--- third_party/libwebrtc/rtc_base/unique_id_generator_gn/moz.build
+++ third_party/libwebrtc/rtc_base/unique_id_generator_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 8a5700f89120..694cd6886a8f 100644
--- third_party/libwebrtc/rtc_base/units/unit_base_gn/moz.build
+++ third_party/libwebrtc/rtc_base/units/unit_base_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,112 +48,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":
 
@@ -154,50 +68,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 037497b88501..44308d06766c 100644
--- third_party/libwebrtc/rtc_base/weak_ptr_gn/moz.build
+++ third_party/libwebrtc/rtc_base/weak_ptr_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 6782a6918724..000000000000
--- third_party/libwebrtc/rtc_base/win/create_direct3d_device_gn/moz.build
+++ /dev/null
@@ -1,85 +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["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 f2ad41ae9f27..000000000000
--- third_party/libwebrtc/rtc_base/win/get_activation_factory_gn/moz.build
+++ /dev/null
@@ -1,85 +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["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 ba15ff2b3c18..000000000000
--- third_party/libwebrtc/rtc_base/win/hstring_gn/moz.build
+++ /dev/null
@@ -1,85 +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["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 8720108cc441..000000000000
--- third_party/libwebrtc/rtc_base/win/windows_version_gn/moz.build
+++ /dev/null
@@ -1,85 +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["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 0c72f4850db5..000000000000
--- third_party/libwebrtc/rtc_base/win32_gn/moz.build
+++ /dev/null
@@ -1,92 +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["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 6571d6610000..8364eaec6364 100644
--- third_party/libwebrtc/rtc_base/zero_memory_gn/moz.build
+++ third_party/libwebrtc/rtc_base/zero_memory_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 aa939b4394b7..000000000000
--- third_party/libwebrtc/sdk/base_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.                                       ###
-
-CMFLAGS += [
-    "-fobjc-arc"
-]
-
-CMMFLAGS += [
-    "-fobjc-arc"
-]
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-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 161ce60f39a6..000000000000
--- third_party/libwebrtc/sdk/helpers_objc_gn/moz.build
+++ /dev/null
@@ -1,75 +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["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 db4fdfb6b108..000000000000
--- third_party/libwebrtc/sdk/videocapture_objc_gn/moz.build
+++ /dev/null
@@ -1,70 +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["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 f705e220de43..000000000000
--- third_party/libwebrtc/sdk/videoframebuffer_objc_gn/moz.build
+++ /dev/null
@@ -1,73 +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["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 12ee5d255fe2..6bd1fd6680b8 100644
--- third_party/libwebrtc/system_wrappers/denormal_disabler_gn/moz.build
+++ third_party/libwebrtc/system_wrappers/denormal_disabler_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 2c548ba00fb6..a701c73887a2 100644
--- third_party/libwebrtc/system_wrappers/field_trial_gn/moz.build
+++ third_party/libwebrtc/system_wrappers/field_trial_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 57f648c68c3e..e2880acbca11 100644
--- third_party/libwebrtc/system_wrappers/metrics_gn/moz.build
+++ third_party/libwebrtc/system_wrappers/metrics_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 315dc3c5a19f..ed99cf26c467 100644
--- third_party/libwebrtc/system_wrappers/system_wrappers_gn/moz.build
+++ third_party/libwebrtc/system_wrappers/system_wrappers_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,200 +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
-
-    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 eef00c758907..40a957d79e39 100644
--- third_party/libwebrtc/test/network/simulated_network_gn/moz.build
+++ third_party/libwebrtc/test/network/simulated_network_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 8ba53a95692c..647a18cc18ac 100644
--- third_party/libwebrtc/test/rtp_test_utils_gn/moz.build
+++ third_party/libwebrtc/test/rtp_test_utils_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,124 +48,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":
 
@@ -166,50 +68,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 3773aea3b30c..05dfadacfca8 100644
--- third_party/libwebrtc/third_party/dav1d/dav1d_gn/moz.build
+++ third_party/libwebrtc/third_party/dav1d/dav1d_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,108 +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
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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":
 
@@ -152,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("dav1d_gn")
diff --git third_party/libwebrtc/third_party/drm/drm_gn/moz.build third_party/libwebrtc/third_party/drm/drm_gn/moz.build
index 06bad5c1495d..b43a1368f34e 100644
--- third_party/libwebrtc/third_party/drm/drm_gn/moz.build
+++ third_party/libwebrtc/third_party/drm/drm_gn/moz.build
@@ -12,20 +12,16 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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/gbm/gbm_gn/moz.build third_party/libwebrtc/third_party/gbm/gbm_gn/moz.build
index 5334af6f6d3e..8ac69036fd19 100644
--- third_party/libwebrtc/third_party/gbm/gbm_gn/moz.build
+++ third_party/libwebrtc/third_party/gbm/gbm_gn/moz.build
@@ -12,20 +12,16 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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
@@ -60,12 +56,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
@@ -79,7 +69,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/libaom/libaom_gn/moz.build third_party/libwebrtc/third_party/libaom/libaom_gn/moz.build
index 8a8fc71f17af..93fd56af47e5 100644
--- third_party/libwebrtc/third_party/libaom/libaom_gn/moz.build
+++ third_party/libwebrtc/third_party/libaom/libaom_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,108 +48,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":
 
@@ -150,50 +68,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 22ab191e5227..a27cb940a7c6 100644
--- third_party/libwebrtc/third_party/libepoxy/libepoxy_gn/moz.build
+++ third_party/libwebrtc/third_party/libepoxy/libepoxy_gn/moz.build
@@ -12,20 +12,16 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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
@@ -61,12 +57,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
@@ -80,7 +70,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 4a72444177d6..0536f67f8865 100644
--- third_party/libwebrtc/third_party/libyuv/libyuv_gn/moz.build
+++ third_party/libwebrtc/third_party/libyuv/libyuv_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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,108 +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
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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":
 
@@ -152,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("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/pipewire/pipewire_gn/moz.build third_party/libwebrtc/third_party/pipewire/pipewire_gn/moz.build
index 7ee6d71247e1..e5048d9d598c 100644
--- third_party/libwebrtc/third_party/pipewire/pipewire_gn/moz.build
+++ third_party/libwebrtc/third_party/pipewire/pipewire_gn/moz.build
@@ -12,21 +12,17 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 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
@@ -61,12 +57,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
@@ -80,7 +70,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/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 07c16154f97d..393215e34c1e 100644
--- third_party/libwebrtc/video/adaptation/video_adaptation_gn/moz.build
+++ third_party/libwebrtc/video/adaptation/video_adaptation_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 b48b001014bc..eebc89a69ef7 100644
--- third_party/libwebrtc/video/config/encoder_config_gn/moz.build
+++ third_party/libwebrtc/video/config/encoder_config_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 b3f38848dde8..02e9a43bc366 100644
--- third_party/libwebrtc/video/config/streams_config_gn/moz.build
+++ third_party/libwebrtc/video/config/streams_config_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 6aeed8259081..670e89595328 100644
--- third_party/libwebrtc/video/corruption_detection/corruption_classifier_gn/moz.build
+++ third_party/libwebrtc/video/corruption_detection/corruption_classifier_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 9e7ad18b2421..a79ced32f2f1 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 5a1b79701b0b..0cfa6950a537 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 0e7ce07afba2..2a396481ef05 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 99c1fae3146f..6a61f9a394da 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 ffcf6099f6c0..968541539a49 100644
--- third_party/libwebrtc/video/corruption_detection/halton_sequence_gn/moz.build
+++ third_party/libwebrtc/video/corruption_detection/halton_sequence_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,179 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    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 d41c0c6b2925..014608d80234 100644
--- third_party/libwebrtc/video/decode_synchronizer_gn/moz.build
+++ third_party/libwebrtc/video/decode_synchronizer_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 5b2a99954cc4..7ed9a69b2f88 100644
--- third_party/libwebrtc/video/frame_cadence_adapter_gn/moz.build
+++ third_party/libwebrtc/video/frame_cadence_adapter_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 6859cfa6b9d4..b07b1298bb9a 100644
--- third_party/libwebrtc/video/frame_decode_scheduler_gn/moz.build
+++ third_party/libwebrtc/video/frame_decode_scheduler_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,123 +48,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":
 
@@ -165,50 +68,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 8ef09f2eec94..c60e05070dc5 100644
--- third_party/libwebrtc/video/frame_decode_timing_gn/moz.build
+++ third_party/libwebrtc/video/frame_decode_timing_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 f76bfc61db99..66b7669f9d5f 100644
--- third_party/libwebrtc/video/frame_dumping_decoder_gn/moz.build
+++ third_party/libwebrtc/video/frame_dumping_decoder_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 c4bad706172c..18ffb380392c 100644
--- third_party/libwebrtc/video/frame_dumping_encoder_gn/moz.build
+++ third_party/libwebrtc/video/frame_dumping_encoder_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 092bbc95e288..f1c6ded0f367 100644
--- third_party/libwebrtc/video/render/incoming_video_stream_gn/moz.build
+++ third_party/libwebrtc/video/render/incoming_video_stream_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 39558b4b3e5b..c1df4e9bd177 100644
--- third_party/libwebrtc/video/render/video_render_frames_gn/moz.build
+++ third_party/libwebrtc/video/render/video_render_frames_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,186 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_X11"] = "1"
-    DEFINES["WEBRTC_BSD"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_FILE_OFFSET_BITS"] = "64"
-    DEFINES["_LARGEFILE64_SOURCE"] = True
-    DEFINES["_LARGEFILE_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
-    DEFINES["NOMINMAX"] = True
-    DEFINES["NTDDI_VERSION"] = "0x0A000000"
-    DEFINES["PSAPI_VERSION"] = "2"
-    DEFINES["RTC_ENABLE_WIN_WGC"] = True
-    DEFINES["UNICODE"] = True
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["WEBRTC_WIN"] = True
-    DEFINES["WIN32"] = True
-    DEFINES["WIN32_LEAN_AND_MEAN"] = True
-    DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
-    DEFINES["WINVER"] = "0x0A00"
-    DEFINES["_ATL_NO_OPENGL"] = True
-    DEFINES["_CRT_RAND_S"] = True
-    DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
-    DEFINES["_HAS_EXCEPTIONS"] = "0"
-    DEFINES["_HAS_NODISCARD"] = True
-    DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
-    DEFINES["_SECURE_ATL"] = True
-    DEFINES["_UNICODE"] = True
-    DEFINES["_WIN32_WINNT"] = "0x0A00"
-    DEFINES["_WINDOWS"] = True
-    DEFINES["__STD_C"] = True
-
-    OS_LIBS += [
-        "crypt32",
-        "iphlpapi",
-        "secur32",
-        "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 f4f66565f437..7dc1d04b59ba 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 29ff4759b500..95d109725a60 100644
--- third_party/libwebrtc/video/unique_timestamp_counter_gn/moz.build
+++ third_party/libwebrtc/video/unique_timestamp_counter_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,175 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_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 edf7a88ed789..bb85d9269feb 100644
--- third_party/libwebrtc/video/video_gn/moz.build
+++ third_party/libwebrtc/video/video_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -62,191 +71,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 d530ed77f21f..239678e8ec81 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
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,190 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_GNU_SOURCE"] = True
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-    OS_LIBS += [
-        "log"
-    ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["WEBRTC_MAC"] = True
-    DEFINES["WEBRTC_POSIX"] = True
-    DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
-    DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
-    DEFINES["__STDC_CONSTANT_MACROS"] = True
-    DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["USE_AURA"] = "1"
-    DEFINES["USE_GLIB"] = "1"
-    DEFINES["USE_NSS_CERTS"] = "1"
-    DEFINES["USE_OZONE"] = "1"
-    DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
-    DEFINES["WEBRTC_POSIX"] = 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 c53b093328e9..e2abf01eacce 100644
--- third_party/libwebrtc/video/video_stream_buffer_controller_gn/moz.build
+++ third_party/libwebrtc/video/video_stream_buffer_controller_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -43,191 +52,32 @@ if not CONFIG["MOZ_DEBUG"]:
 if CONFIG["MOZ_DEBUG"] == "1":
 
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["ANDROID"] = True
-    DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
-    DEFINES["HAVE_SYS_UIO_H"] = True
-    DEFINES["WEBRTC_ANDROID"] = True
-    DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
-    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 f971adeadf17..e988fef7d80f 100644
--- third_party/libwebrtc/video/video_stream_encoder_impl_gn/moz.build
+++ third_party/libwebrtc/video/video_stream_encoder_impl_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_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("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 5d1297f9aa4e..30518fdfa2be 100644
--- third_party/libwebrtc/video/video_stream_encoder_interface_gn/moz.build
+++ third_party/libwebrtc/video/video_stream_encoder_interface_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,119 +48,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":
 
@@ -161,50 +68,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 affa5998b64e..0fbfe6858f2a 100644
--- third_party/libwebrtc/webrtc_gn/moz.build
+++ third_party/libwebrtc/webrtc_gn/moz.build
@@ -12,11 +12,20 @@ AllowCompilerWarnings()
 DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
 DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
 DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["USE_GLIB"] = "1"
+DEFINES["USE_OZONE"] = "1"
+DEFINES["WEBRTC_BSD"] = True
 DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
 DEFINES["WEBRTC_LIBRARY_IMPL"] = True
 DEFINES["WEBRTC_MOZILLA_BUILD"] = True
 DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_POSIX"] = True
 DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+DEFINES["_FILE_OFFSET_BITS"] = "64"
+DEFINES["_LARGEFILE64_SOURCE"] = True
+DEFINES["_LARGEFILE_SOURCE"] = True
+DEFINES["__STDC_CONSTANT_MACROS"] = True
+DEFINES["__STDC_FORMAT_MACROS"] = True
 
 FINAL_LIBRARY = "xul"
 
@@ -39,144 +48,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 += [
-        "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
+    DEFINES["WEBRTC_USE_PIPEWIRE"] = 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
+    LOCAL_INCLUDES += [
+        "/third_party/pipewire/"
+    ]
 
 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 += [
         "/third_party/pipewire/"
@@ -185,7 +73,6 @@ if CONFIG["TARGET_CPU"] == "mips32":
 if CONFIG["TARGET_CPU"] == "mips64":
 
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
 
     LOCAL_INCLUDES += [
         "/third_party/pipewire/"
@@ -194,32 +81,22 @@ if CONFIG["TARGET_CPU"] == "mips64":
 if CONFIG["TARGET_CPU"] == "x86":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
+    DEFINES["WEBRTC_USE_PIPEWIRE"] = True
+
+    LOCAL_INCLUDES += [
+        "/third_party/pipewire/"
+    ]
 
 if CONFIG["TARGET_CPU"] == "x86_64":
 
     DEFINES["WEBRTC_ENABLE_AVX2"] = True
+    DEFINES["WEBRTC_USE_PIPEWIRE"] = True
 
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
-    DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
-    DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
+    LOCAL_INCLUDES += [
+        "/third_party/pipewire/"
+    ]
 
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "FreeBSD":
 
     DEFINES["USE_X11"] = "1"
 
@@ -233,46 +110,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["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-    LOCAL_INCLUDES += [
-        "/third_party/pipewire/"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
-    DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-    LOCAL_INCLUDES += [
-        "/third_party/pipewire/"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
-    DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-    LOCAL_INCLUDES += [
-        "/third_party/pipewire/"
-    ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
-    DEFINES["WEBRTC_USE_PIPEWIRE"] = True
-    DEFINES["_GNU_SOURCE"] = True
-
-    LOCAL_INCLUDES += [
-        "/third_party/pipewire/"
-    ]
-
 Library("webrtc_gn")
