1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-19 08:13:21 +00:00

audio/webrtc-audio-processing: add new port

Audio processing routines extracted from WebRTC project into a
standalone library. It provides the following features:

- Acoustic echo cancellation
- Acoustic echo control for mobile
- Automatic gain control
- High-pass filter
- Level estimator
- Noise suppression
- Voice activity detection

https://freedesktop.org/software/pulseaudio/webrtc-audio-processing/
This commit is contained in:
Jan Beich 2018-10-12 18:22:06 +00:00
parent 36d13278ed
commit 49f922705a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=481919
10 changed files with 223 additions and 0 deletions

View File

@ -869,6 +869,7 @@
SUBDIR += waveplay
SUBDIR += wavpack
SUBDIR += wavplay
SUBDIR += webrtc-audio-processing
SUBDIR += whysynth
SUBDIR += wildmidi
SUBDIR += wmalbum

View File

@ -0,0 +1,18 @@
# $FreeBSD$
PORTNAME= webrtc-audio-processing
PORTVERSION= 0.3.1
CATEGORIES= audio
MASTER_SITES= https://freedesktop.org/software/pulseaudio/${PORTNAME}/
MAINTAINER= jbeich@FreeBSD.org
COMMENT= AudioProcessing module from WebRTC project
LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/COPYING
USES= autoreconf compiler:c++11-lib libtool pkgconfig tar:xz
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1532354746
SHA256 (webrtc-audio-processing-0.3.1.tar.xz) = a0fdd938fd85272d67e81572c5a4d9e200a0c104753cb3c209ded175ce3c5dbf
SIZE (webrtc-audio-processing-0.3.1.tar.xz) = 695920

View File

@ -0,0 +1,18 @@
- Add WEBRTC_BSD as it's closer to WEBRTC_LINUX than WEBRTC_MAC
--- configure.ac.orig 2018-07-23 14:02:57 UTC
+++ configure.ac
@@ -63,6 +63,13 @@ AS_CASE(["${host}"],
OS_LDFLAGS="-lrt -lpthread"
HAVE_POSIX=1
],
+ [*-*dragonfly*|*-*bsd*],
+ [
+ OS_CFLAGS="-DWEBRTC_BSD -DWEBRTC_THREAD_RR"
+ PLATFORM_CFLAGS="-DWEBRTC_POSIX"
+ OS_LDFLAGS="-lpthread"
+ HAVE_POSIX=1
+ ],
[*-*darwin*],
[
OS_CFLAGS="-DWEBRTC_MAC -DWEBRTC_THREAD_RR -DWEBRTC_CLOCK_TYPE_REALTIME"

View File

@ -0,0 +1,70 @@
- Drop unnecessary dependency on libexecinfo for GCC build
https://chromium.googlesource.com/external/webrtc/+/7c4dedade158%5E!/
--- webrtc/base/checks.cc.orig 2018-07-23 14:02:57 UTC
+++ webrtc/base/checks.cc
@@ -11,16 +11,10 @@
// Most of this was borrowed (with minor modifications) from V8's and Chromium's
// src/base/logging.cc.
-// Use the C++ version to provide __GLIBCXX__.
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
-#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
-#include <cxxabi.h>
-#include <execinfo.h>
-#endif
-
#if defined(WEBRTC_ANDROID)
#define LOG_TAG "rtc"
#include <android/log.h> // NOLINT
@@ -51,39 +45,6 @@ void PrintError(const char* format, ...) {
va_end(args);
}
-// TODO(ajm): This works on Mac (although the parsing fails) but I don't seem
-// to get usable symbols on Linux. This is copied from V8. Chromium has a more
-// advanced stace trace system; also more difficult to copy.
-void DumpBacktrace() {
-#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
- void* trace[100];
- int size = backtrace(trace, sizeof(trace) / sizeof(*trace));
- char** symbols = backtrace_symbols(trace, size);
- PrintError("\n==== C stack trace ===============================\n\n");
- if (size == 0) {
- PrintError("(empty)\n");
- } else if (symbols == NULL) {
- PrintError("(no symbols)\n");
- } else {
- for (int i = 1; i < size; ++i) {
- char mangled[201];
- if (sscanf(symbols[i], "%*[^(]%*[(]%200[^)+]", mangled) == 1) { // NOLINT
- PrintError("%2d: ", i);
- int status;
- size_t length;
- char* demangled = abi::__cxa_demangle(mangled, NULL, &length, &status);
- PrintError("%s\n", demangled != NULL ? demangled : mangled);
- free(demangled);
- } else {
- // If parsing failed, at least print the unparsed symbol.
- PrintError("%s\n", symbols[i]);
- }
- }
- }
- free(symbols);
-#endif
-}
-
FatalMessage::FatalMessage(const char* file, int line) {
Init(file, line);
}
@@ -99,7 +60,6 @@ NO_RETURN FatalMessage::~FatalMessage() {
fflush(stderr);
stream_ << std::endl << "#" << std::endl;
PrintError(stream_.str().c_str());
- DumpBacktrace();
fflush(stderr);
abort();
}

View File

@ -0,0 +1,48 @@
- Implement CurrentThreadId() using global thread ID
- Implement SetCurrentThreadName()
--- webrtc/base/platform_thread.cc.orig 2018-07-23 14:02:57 UTC
+++ webrtc/base/platform_thread.cc
@@ -19,6 +19,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
+
namespace rtc {
PlatformThreadId CurrentThreadId() {
@@ -32,9 +38,17 @@ PlatformThreadId CurrentThreadId() {
ret = syscall(__NR_gettid);
#elif defined(WEBRTC_ANDROID)
ret = gettid();
+#elif defined(__DragonFly__) // WEBRTC_BSD
+ ret = lwp_gettid();
+#elif defined(__FreeBSD__) // WEBRTC_BSD
+ ret = pthread_getthreadid_np();
+#elif defined(__NetBSD__) // WEBRTC_BSD
+ ret = _lwp_self();
#else
// Default implementation for nacl and solaris.
- ret = reinterpret_cast<pid_t>(pthread_self());
+ // WEBRTC_BSD: pthread_t is a pointer, so cannot be casted to pid_t
+ // (aka int32_t) on 64-bit archs. Required on OpenBSD.
+ ret = reinterpret_cast<uintptr_t>(pthread_self());
#endif
#endif // defined(WEBRTC_POSIX)
RTC_DCHECK(ret);
@@ -76,6 +90,10 @@ void SetCurrentThreadName(const char* name) {
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name));
#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);
#endif
}

View File

@ -0,0 +1,13 @@
- BSD macro (in sys/param.h) is an archaic of the (University of California) past
--- webrtc/base/stringutils.h.orig 2018-07-23 14:02:57 UTC
+++ webrtc/base/stringutils.h
@@ -23,7 +23,7 @@
#endif // WEBRTC_WIN
#if defined(WEBRTC_POSIX)
-#ifdef BSD
+#ifdef WEBRTC_BSD
#include <stdlib.h>
#else // BSD
#include <alloca.h>

View File

@ -0,0 +1,22 @@
- Match conditional in webrtc/system_wrappers/Makefile.am
--- webrtc/system_wrappers/source/condition_variable.cc.orig 2018-07-23 14:02:57 UTC
+++ webrtc/system_wrappers/source/condition_variable.cc
@@ -14,7 +14,7 @@
#include <windows.h>
#include "webrtc/system_wrappers/source/condition_variable_event_win.h"
#include "webrtc/system_wrappers/source/condition_variable_native_win.h"
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
+#elif defined(WEBRTC_POSIX)
#include <pthread.h>
#include "webrtc/system_wrappers/source/condition_variable_posix.h"
#endif
@@ -31,7 +31,7 @@ ConditionVariableWrapper* ConditionVariableWrapper::Cr
ret_val = new ConditionVariableEventWin();
}
return ret_val;
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
+#elif defined(WEBRTC_POSIX)
return ConditionVariablePosix::Create();
#else
return NULL;

View File

@ -0,0 +1,12 @@
Audio processing routines extracted from WebRTC project into a
standalone library. It provides the following features:
- Acoustic echo cancellation
- Acoustic echo control for mobile
- Automatic gain control
- High-pass filter
- Level estimator
- Noise suppression
- Voice activity detection
WWW: https://freedesktop.org/software/pulseaudio/webrtc-audio-processing/

View File

@ -0,0 +1,18 @@
include/webrtc_audio_processing/webrtc/base/arraysize.h
include/webrtc_audio_processing/webrtc/base/basictypes.h
include/webrtc_audio_processing/webrtc/base/checks.h
include/webrtc_audio_processing/webrtc/base/constructormagic.h
include/webrtc_audio_processing/webrtc/base/maybe.h
include/webrtc_audio_processing/webrtc/base/platform_file.h
include/webrtc_audio_processing/webrtc/common.h
include/webrtc_audio_processing/webrtc/common_types.h
include/webrtc_audio_processing/webrtc/modules/audio_processing/beamformer/array_util.h
include/webrtc_audio_processing/webrtc/modules/audio_processing/include/audio_processing.h
include/webrtc_audio_processing/webrtc/modules/interface/module_common_types.h
include/webrtc_audio_processing/webrtc/system_wrappers/include/trace.h
include/webrtc_audio_processing/webrtc/typedefs.h
lib/libwebrtc_audio_processing.a
lib/libwebrtc_audio_processing.so
lib/libwebrtc_audio_processing.so.1
lib/libwebrtc_audio_processing.so.1.0.0
libdata/pkgconfig/webrtc-audio-processing.pc