[Git][pulseaudio/webrtc-audio-processing][master] Add support for BSD systems
Arun Raghavan (@arun)
gitlab at gitlab.freedesktop.org
Mon Dec 30 17:20:16 UTC 2024
Arun Raghavan pushed to branch master at PulseAudio / webrtc-audio-processing
Commits:
2a318149 by Jan Beich at 2024-12-30T17:18:54+00:00
Add support for BSD systems
webrtc/rtc_base/checks.cc:158:28: error: use of undeclared identifier 'LAST_SYSTEM_ERROR'
158 | file, line, LAST_SYSTEM_ERROR, message);
| ^
webrtc/rtc_base/checks.cc:220:16: error: use of undeclared identifier 'LAST_SYSTEM_ERROR'
220 | LAST_SYSTEM_ERROR);
| ^
In file included from webrtc/rtc_base/platform_thread_types.cc:11:
webrtc/rtc_base/platform_thread_types.h:47:1: error: unknown type name 'PlatformThreadId'
47 | PlatformThreadId CurrentThreadId();
| ^
webrtc/rtc_base/platform_thread_types.h:52:1: error: unknown type name 'PlatformThreadRef'
52 | PlatformThreadRef CurrentThreadRef();
| ^
webrtc/rtc_base/platform_thread_types.h:55:29: error: unknown type name 'PlatformThreadRef'
55 | bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b);
| ^
webrtc/rtc_base/platform_thread_types.h:55:57: error: unknown type name 'PlatformThreadRef'
55 | bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b);
| ^
webrtc/rtc_base/platform_thread_types.cc:37:1: error: unknown type name 'PlatformThreadId'
37 | PlatformThreadId CurrentThreadId() {
| ^
webrtc/rtc_base/platform_thread_types.cc:58:1: error: unknown type name 'PlatformThreadRef'
58 | PlatformThreadRef CurrentThreadRef() {
| ^
webrtc/rtc_base/platform_thread_types.cc:68:29: error: unknown type name 'PlatformThreadRef'
68 | bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b) {
| ^
webrtc/rtc_base/platform_thread_types.cc:68:57: error: unknown type name 'PlatformThreadRef'
68 | bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b) {
| ^
In file included from webrtc/rtc_base/event_tracer.cc:30:
In file included from webrtc/api/sequence_checker.h:15:
In file included from webrtc/rtc_base/synchronization/sequence_checker_internal.h:18:
webrtc/rtc_base/synchronization/mutex.h:28:2: error: Unsupported platform.
28 | #error Unsupported platform.
| ^
webrtc/rtc_base/synchronization/mutex.h:52:3: error: unknown type name 'MutexImpl'
52 | MutexImpl impl_;
| ^
- - - - -
2 changed files:
- meson.build
- webrtc/rtc_base/platform_thread_types.cc
Changes:
=====================================
meson.build
=====================================
@@ -87,6 +87,11 @@ elif host_system == 'linux'
os_deps += [cc.find_library('rt', required : false)]
os_deps += [dependency('threads')]
have_posix = true
+elif (host_system == 'dragonfly' or host_system == 'freebsd' or
+ host_system == 'netbsd' or host_system == 'openbsd')
+ os_cflags += ['-DWEBRTC_BSD', '-DWEBRTC_THREAD_RR']
+ os_deps += [dependency('threads')]
+ have_posix = true
elif host_system == 'windows'
platform_cflags += ['-DWEBRTC_WIN', '-D_WIN32']
# this one is for MinGW to get format specifiers from inttypes.h in C++
=====================================
webrtc/rtc_base/platform_thread_types.cc
=====================================
@@ -15,6 +15,12 @@
#include <sys/syscall.h>
#endif
+#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
+#include <pthread_np.h>
+#elif defined(__NetBSD__) // WEBRTC_BSD
+#include <lwp.h>
+#endif
+
#if defined(WEBRTC_WIN)
#include "rtc_base/arraysize.h"
@@ -46,6 +52,12 @@ PlatformThreadId CurrentThreadId() {
return zx_thread_self();
#elif defined(WEBRTC_LINUX)
return syscall(__NR_gettid);
+#elif defined(__DragonFly__) || defined(__FreeBSD__) // WEBRTC_BSD
+ return pthread_getthreadid_np();
+#elif defined(__NetBSD__) // WEBRTC_BSD
+ return _lwp_self();
+#elif defined(__OpenBSD__) // WEBRTC_BSD
+ return getthrid();
#elif defined(__EMSCRIPTEN__)
return static_cast<PlatformThreadId>(pthread_self());
#else
@@ -116,6 +128,10 @@ void SetCurrentThreadName(const char* name) {
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name)); // NOLINT
#elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
pthread_setname_np(name);
+#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) // WEBRTC_BSD
+ pthread_set_name_np(pthread_self(), name);
+#elif defined(__NetBSD__) // WEBRTC_BSD
+ pthread_setname_np(pthread_self(), "%s", (void*)name);
#elif defined(WEBRTC_FUCHSIA)
zx_status_t status = zx_object_set_property(zx_thread_self(), ZX_PROP_NAME,
name, strlen(name));
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/commit/2a318149f8d5094c82306b8091a7a8b5194bf9c1
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/commit/2a318149f8d5094c82306b8091a7a8b5194bf9c1
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20241230/bdec77e6/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list