Source code

Revision control

Copy as Markdown

Other Tools

From: Michael Froman <mfroman@mozilla.com>
Date: Wed, 30 Jul 2025 20:25:00 +0000
Subject: Bug 1973648 - move applicable libwebrtc changes to our new
libwebrtc_overrides location. r=ng
---
X11/extensions/Xrandr.h | 29 --------
call/BUILD.gn | 6 --
call/call_basic_stats.cc | 20 ------
call/call_basic_stats.h | 21 ------
common_audio/intrin.h | 8 ---
modules/desktop_capture/BUILD.gn | 5 ++
.../desktop_capture/linux/x11/x_error_trap.cc | 70 -------------------
.../desktop_capture/linux/x11/x_error_trap.h | 51 --------------
8 files changed, 5 insertions(+), 205 deletions(-)
delete mode 100644 X11/extensions/Xrandr.h
delete mode 100644 call/call_basic_stats.cc
delete mode 100644 call/call_basic_stats.h
delete mode 100644 common_audio/intrin.h
delete mode 100644 modules/desktop_capture/linux/x11/x_error_trap.cc
delete mode 100644 modules/desktop_capture/linux/x11/x_error_trap.h
diff --git a/X11/extensions/Xrandr.h b/X11/extensions/Xrandr.h
deleted file mode 100644
index 876e8b4c7f..0000000000
--- a/X11/extensions/Xrandr.h
+++ /dev/null
@@ -1,29 +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/. */
-
-// Hack to compensate for the old (<1.5) Xrandr development headers on
-// Mozilla's build boxes.
-
-#ifndef _XRANDR_H_WRAPPER_HACK_
-#define _XRANDR_H_WRAPPER_HACK_
-
-#include_next <X11/extensions/Xrandr.h>
-
-#if RANDR_MAJOR == 1 && RANDR_MINOR < 5 // defined in randr.h
-typedef struct _XRRMonitorInfo {
- Atom name;
- Bool primary;
- Bool automatic;
- int noutput;
- int x;
- int y;
- int width;
- int height;
- int mwidth;
- int mheight;
- RROutput *outputs;
-} XRRMonitorInfo;
-#endif
-
-#endif // _XRANDR_H_WRAPPER_HACK_
diff --git a/call/BUILD.gn b/call/BUILD.gn
index aaae7bb9a9..0cf0e2fcf0 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -33,12 +33,6 @@ rtc_library("call_interfaces") {
"syncable.cc",
"syncable.h",
]
- if (build_with_mozilla) {
- sources += [
- "call_basic_stats.cc",
- "call_basic_stats.h",
- ]
- }
deps = [
":audio_sender_interface",
diff --git a/call/call_basic_stats.cc b/call/call_basic_stats.cc
deleted file mode 100644
index 1882dfefea..0000000000
--- a/call/call_basic_stats.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "call/call_basic_stats.h"
-
-#include "rtc_base/strings/string_builder.h"
-
-namespace webrtc {
-
-std::string CallBasicStats::ToString(int64_t time_ms) const {
- char buf[1024];
- SimpleStringBuilder ss(buf);
- ss << "Call stats: " << time_ms << ", {";
- ss << "send_bw_bps: " << send_bandwidth_bps << ", ";
- ss << "recv_bw_bps: " << recv_bandwidth_bps << ", ";
- ss << "max_pad_bps: " << max_padding_bitrate_bps << ", ";
- ss << "pacer_delay_ms: " << pacer_delay_ms << ", ";
- ss << "rtt_ms: " << rtt_ms;
- ss << '}';
- return ss.str();
-}
-
-} // namespace webrtc
diff --git a/call/call_basic_stats.h b/call/call_basic_stats.h
deleted file mode 100644
index 98febe9405..0000000000
--- a/call/call_basic_stats.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef CALL_CALL_BASIC_STATS_H_
-#define CALL_CALL_BASIC_STATS_H_
-
-#include <string>
-
-namespace webrtc {
-
-// named to avoid conflicts with video/call_stats.h
-struct CallBasicStats {
- std::string ToString(int64_t time_ms) const;
-
- int send_bandwidth_bps = 0; // Estimated available send bandwidth.
- int max_padding_bitrate_bps = 0; // Cumulative configured max padding.
- int recv_bandwidth_bps = 0; // Estimated available receive bandwidth.
- int64_t pacer_delay_ms = 0;
- int64_t rtt_ms = -1;
-};
-
-} // namespace webrtc
-
-#endif // CALL_CALL_BASIC_STATS_H_
diff --git a/common_audio/intrin.h b/common_audio/intrin.h
deleted file mode 100644
index f6ff7f218f..0000000000
--- a/common_audio/intrin.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#if defined (__SSE__)
- #include <immintrin.h>
- #if defined (__clang__)
- #include <avxintrin.h>
- #include <avx2intrin.h>
- #include <fmaintrin.h>
- #endif
-#endif
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
index f9c416bfee..e7047abc53 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
@@ -391,6 +391,11 @@ rtc_library("desktop_capture") {
]
if (build_with_mozilla) {
libs -= [ "Xtst" ]
+ # Mozilla provides custom impl of x_error_trap.*
+ sources -= [
+ "linux/x11/x_error_trap.cc",
+ "linux/x11/x_error_trap.h",
+ ]
}
}
diff --git a/modules/desktop_capture/linux/x11/x_error_trap.cc b/modules/desktop_capture/linux/x11/x_error_trap.cc
deleted file mode 100644
index 3314dd286c..0000000000
--- a/modules/desktop_capture/linux/x11/x_error_trap.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "modules/desktop_capture/linux/x11/x_error_trap.h"
-
-#include <stddef.h>
-
-#include <limits>
-
-#include "rtc_base/checks.h"
-
-
-namespace webrtc {
-
-Bool XErrorTrap::XServerErrorHandler(Display* display, xReply* rep,
- char* /* buf */, int /* len */,
- XPointer data) {
- XErrorTrap* self = reinterpret_cast<XErrorTrap*>(data);
- if (rep->generic.type != X_Error ||
- // Overflow-safe last_request_read <= last_ignored_request_ for skipping
- // async replies from requests before XErrorTrap was created.
- self->last_ignored_request_ - display->last_request_read <
- std::numeric_limits<unsigned long>::max() >> 1)
- return False;
- self->last_xserver_error_code_ = rep->error.errorCode;
- return True;
-}
-
-XErrorTrap::XErrorTrap(Display* display)
- : display_(display),
- last_xserver_error_code_(0),
- enabled_(true) {
- // Use async_handlers instead of XSetErrorHandler(). async_handlers can
- // remain in place and then be safely removed at the right time even if a
- // handler change happens concurrently on another thread. async_handlers
- // are processed first and so can prevent errors reaching the global
- // XSetErrorHandler handler. They also will not see errors from or affect
- // handling of errors on other Displays, which may be processed on other
- // threads.
- LockDisplay(display);
- async_handler_.next = display->async_handlers;
- async_handler_.handler = XServerErrorHandler;
- async_handler_.data = reinterpret_cast<XPointer>(this);
- display->async_handlers = &async_handler_;
- last_ignored_request_ = display->request;
- UnlockDisplay(display);
-}
-
-int XErrorTrap::GetLastErrorAndDisable() {
- assert(enabled_);
- enabled_ = false;
- LockDisplay(display_);
- DeqAsyncHandler(display_, &async_handler_);
- UnlockDisplay(display_);
- return last_xserver_error_code_;
-}
-
-XErrorTrap::~XErrorTrap() {
- if (enabled_)
- GetLastErrorAndDisable();
-}
-
-} // namespace webrtc
diff --git a/modules/desktop_capture/linux/x11/x_error_trap.h b/modules/desktop_capture/linux/x11/x_error_trap.h
deleted file mode 100644
index df7e86bf03..0000000000
--- a/modules/desktop_capture/linux/x11/x_error_trap.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef MODULES_DESKTOP_CAPTURE_LINUX_X11_X_ERROR_TRAP_H_
-#define MODULES_DESKTOP_CAPTURE_LINUX_X11_X_ERROR_TRAP_H_
-
-#include <X11/Xlibint.h>
-#undef max // Xlibint.h defines this and it breaks std::max
-#undef min // Xlibint.h defines this and it breaks std::min
-
-namespace webrtc {
-
-// Helper class that registers X Window error handler. Caller can use
-// GetLastErrorAndDisable() to get the last error that was caught, if any.
-// An XErrorTrap may be constructed on any thread, but errors are collected
-// from all threads and so |display| should be used only on one thread.
-// Other Displays are unaffected.
-class XErrorTrap {
- public:
- explicit XErrorTrap(Display* display);
- ~XErrorTrap();
-
- XErrorTrap(const XErrorTrap&) = delete;
- XErrorTrap& operator=(const XErrorTrap&) = delete;
-
- // Returns last error and removes unregisters the error handler.
- // Must not be called more than once.
- int GetLastErrorAndDisable();
-
- private:
- static Bool XServerErrorHandler(Display* display, xReply* rep,
- char* /* buf */, int /* len */,
- XPointer data);
-
- _XAsyncHandler async_handler_;
- Display* display_;
- unsigned long last_ignored_request_;
- int last_xserver_error_code_;
- bool enabled_;
-};
-
-} // namespace webrtc
-
-#endif // MODULES_DESKTOP_CAPTURE_LINUX_X11_X_ERROR_TRAP_H_