36 Commits
v1.0 ... v1.2

Author SHA1 Message Date
c9b0a675e4 build: Bump version to 1.2 2023-09-01 11:05:31 -04:00
315b2222a8 meson: Update minimum version based on what abseil wrap needs 2023-08-13 17:42:29 -04:00
bc401b3cbf build: Expose absl as a dependency of webrtc-audio-processing
This is needed because the audio processing header references
abseil's optional.h. Clean up the declared dependencies while we're at
it.

Fixes: https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/merge_requests/34
2023-08-13 17:42:29 -04:00
92a4765a7e meson: Update to latest wrap, install required absl headers 2023-06-01 17:46:28 +05:30
c76b8bf340 doc: Update tarball generation process
Use meson dist, include subproject tarballs, and sha256sum files are
also autogenerated.
2023-05-25 18:25:51 -04:00
cdec109331 file_utils.h: Fix build with gcc-13
* add missing include as reported by gcc-13:
webrtc/modules/audio_processing/transient/file_utils.cc:11:
../webrtc-audio-processing-1.0/webrtc/modules/audio_processing/transient/file_utils.h:36:35: error: 'uint8_t' does not name a type
   36 | int ConvertByteArrayToFloat(const uint8_t bytes[4], float* out);
      |                                   ^~~~~~~
webrtc/modules/audio_processing/transient/file_utils.h:17:1: note: 'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
   16 | #include "rtc_base/system/file_wrapper.h"
  +++ |+#include <cstdint>
   17 |

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
2023-05-25 18:13:04 -04:00
096b0eaed2 meson: Fixes for MSVC build
winsock2.h must be included before windows.h or alternative
definitions of `struct sockaddr` are defined.

```
FAILED: webrtc/rtc_base/liblibbase.a.p/logging.cc.obj
"cl" "-Iwebrtc\rtc_base\liblibbase.a.p" "-Iwebrtc\rtc_base" "-I..\webrtc\rtc_base" "-Iwebrtc" "-I..\webrtc" "-Isubprojects\abseil-cpp-20230125.1" "-I..\subprojects\abseil-cpp-20230125.1" "/MD" "/nologo" "/showIncludes" "/utf-8" "/Zc:__cplusplus" "/W2" "/EHsc" "/std:c++17" "/permissive-" "/O2" "/Zi" "-DWEBRTC_LIBRARY_
IMPL" "-DWEBRTC_ENABLE_SYMBOL_EXPORT" "-DNDEBUG" "-DWEBRTC_WIN" "-D_WIN32" "-U__STRICT_ANSI__" "-D__STDC_FORMAT_MACROS=1" "-DNOMINMAX" "-DWEBRTC_ENABLE_AVX2" "/Fdwebrtc\rtc_base\liblibbase.a.p\logging.cc.pdb" /Fowebrtc/rtc_base/liblibbase.a.p/logging.cc.obj "/c" ../webrtc/rtc_base/logging.cc
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared\ws2def.h(103): warning C4005: 'AF_IPX': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um\winsock.h(457): note: see previous definition of 'AF_IPX'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared\ws2def.h(147): warning C4005: 'AF_MAX': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um\winsock.h(476): note: see previous definition of 'AF_MAX'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared\ws2def.h(187): warning C4005: 'SO_DONTLINGER': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um\winsock.h(399): note: see previous definition of 'SO_DONTLINGER'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared\ws2def.h(240): error C2011: 'sockaddr': 'struct' type redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um\winsock.h(482): note: see declaration of 'sockaddr'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared\ws2def.h(442): error C2143: syntax error: missing '}' before 'constant'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared\ws2def.h(442): error C2059: syntax error: 'constant'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared\ws2def.h(496): error C2143: syntax error: missing ';' before '}'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared\ws2def.h(496): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared\ws2def.h(496): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
...
```
2023-05-26 03:17:31 +05:30
b24229cbbc meson: Ensure that abseil is built with c++17 too
subprojects do not inherit $lang_std default values from the project.
2023-05-26 03:17:31 +05:30
55239c4ca2 ci: Add jobs for MSVC, macOS, iOS, Android 2023-05-26 03:17:31 +05:30
a47df351ca ci: Bump ubuntu version to 22.10
Contains absl with pkgconfig files.
2023-05-26 03:17:31 +05:30
4125ace620 meson: Fix compatibility with Fedora's abseil-cpp package
1. Fedora abseil-cpp package is built with C++17:
   https://src.fedoraproject.org/rpms/abseil-cpp/blob/rawhide/f/abseil-cpp.spec
2. There is no `absl_types` pkgconfig file, and it's only needed on iOS
2023-05-26 03:16:38 +05:30
aa32d179d0 meson: Update abseil-cpp to latest wrap 2023-05-26 00:45:29 +05:30
9a362bd149 meson: Don't require cross files to set host_system = ios
It's not specified as a host_system by meson, so people will often not
set it.
2023-05-26 00:45:29 +05:30
8366ff0ce0 meson: Get rid of cmake and manual library searching
Simplify fallback, and prefer it. `[provide]` section requires meson
0.55, so require that.

pkg-config lookup is only provided for distros, since they dislike
static linking / vendoring.
2023-05-26 00:45:00 +05:30
ca1186946d build: don't detect neon again when building on aarch64
it will try to add -mfpu=neon to cflags not available on aarch64 since
neon is mandatory there
2022-05-21 14:10:48 +02:00
26f4493405 build: fix -Dneon=runtime 2022-05-21 14:08:15 +02:00
e31340c243 Add builds for distro and vendored versions of abseil 2021-10-20 11:16:19 -04:00
5a5aa66ada Add an abseil subproject and correctly specify fallback deps 2021-10-20 11:16:18 -04:00
0cc2ebeda2 Add missing absl library for bad_optional_access 2021-10-20 11:15:57 -04:00
6064932abf Add missing header for C++17 compatibility
Hopefully we can drop this change with the next update.
2021-10-19 18:06:37 -04:00
8bf9efad15 Use pkg-config for abseil-cpp detection if available
This should make things a bit easier.
2021-10-19 18:06:37 -04:00
ff85c98683 Some fixes for MinGW
* Rename Windows.h uses to windows.h
  * Comment out structured exception handling usage

Makes MinGW happier. Mostly the same as previous work by
Nicolas Dufresne <nicolas.dufresne@collabora.com>, with the exception
that we now don't try to invoke RaiseException which would fail in MinGW
as it raises a Windows structured exception.
2021-10-19 16:09:07 -04:00
57ec282d4f Remove rnn_vad_tool.cc that contains main(). 2021-09-08 12:21:50 +00:00
6e37f37c4e build: Split out iSAC VAD sources into a separate dependency
Avoid having to link webrtc-audio-processing with webrtc-audio-coding,
and makes the required symbols directly available.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/merge_requests/22>
2021-06-19 13:06:12 -04:00
b8ad0dfc22 build: Add framework deps on macOS and iOS
Part-of: <https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/merge_requests/21>
2021-06-18 23:44:18 -04:00
e47b68df57 arch.h: Add RISC-V support 2021-06-17 01:48:37 +00:00
e74894baeb build: Add library-based absl detection as a fallback
This should help for cases where users can make abseil-cpp available but
wiring up the CMake-build isn't that easy (for example, while
cross-compiling).
2021-06-05 18:37:23 -04:00
589a744585 Fix build on Android
There's a bit of system integration that we haven't pulled in (as it has
transitive dependencies), so we manually stub it out.
2021-06-05 18:16:18 -04:00
8ac052ad6f doc: Add some build instructions to README 2021-02-12 15:44:49 -05:00
b34c1d5746 build: Fix ARM ISA detection
armv7 isn't a real cpu_family in meson, so drop that. The detection for
__ARM_ARCH_ISA_ARM was also inverted.

Fixes: https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/issues/6
2020-12-11 08:16:04 -05:00
3f9907f93d build: Use cmake to look up abseil dependency
This should be much more robust than looking up the library directly.

Fixes: https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/-/issues/4
2020-12-10 19:20:09 -05:00
ce1a78887a build: Revert top-level project name to not have a prefix
Should make meson dist easier to work with.
2020-12-10 18:24:05 -05:00
8ce8bebb7d build: Bump project version to 1.1 2020-12-10 18:24:05 -05:00
00ae7eb234 doc: Fix up release process
Missed a trailing '/' while generating the archive with disastrous
results.
2020-11-27 16:47:09 -05:00
d353e92425 doc: Fix up links in markdown 2020-11-27 14:50:02 -05:00
6a4d14d5c0 doc: Some minor README cleanups 2020-11-27 14:46:36 -05:00
19 changed files with 421 additions and 216 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@
build/
depcomp
install/
subprojects/*/

View File

@ -19,8 +19,8 @@ variables:
# CI runs, for example when adding new packages to FDO_DISTRIBUTION_PACKAGES.
# The tag is an arbitrary string that identifies the exact container
# contents.
BASE_TAG: '2020-11-27.1'
FDO_DISTRIBUTION_VERSION: '20.10'
BASE_TAG: '2023-05-25.0'
FDO_DISTRIBUTION_VERSION: '22.10'
FDO_UPSTREAM_REPO: 'pulseaudio/webrtc-audio-processing'
include:
@ -43,9 +43,12 @@ include:
FDO_DISTRIBUTION_PACKAGES: >-
g++
gcc
git-core
cmake
libabsl-dev
meson
ninja-build
pkg-config
python3-setuptools
# Used to extend both container and build jobs
@ -75,24 +78,205 @@ build-container-aarch64:
stage: container
# Common build template
.build:
.build-distro-absl:
stage: build
extends:
- .fdo.distribution-image@ubuntu
script:
- meson build
- cd build
- ninja
- meson setup --wrap-mode=nofallback builddir
- ninja -C builddir
artifacts:
expire_in: '5 days'
when: 'always'
paths:
- build/
- "builddir/meson-logs/*txt"
build-x86_64:
.build-vendored-absl:
stage: build
extends:
- .build
- .fdo.distribution-image@ubuntu
script:
- meson setup --force-fallback-for=abseil-cpp builddir
- ninja -C builddir
artifacts:
expire_in: '5 days'
when: 'always'
paths:
- "builddir/meson-logs/*txt"
build-distro-absl-x86_64:
extends:
- .build-distro-absl
- .ubuntu-x86_64
build-aarch64:
build-vendored-absl-x86_64:
extends:
- .build
- .build-vendored-absl
- .ubuntu-x86_64
build-distro-absl-aarch64:
extends:
- .build-distro-absl
- .ubuntu-aarch64
build-vendored-absl-aarch64:
extends:
- .build-vendored-absl
- .ubuntu-aarch64
# Update from:
# https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/.gitlab-ci.yml
# https://gitlab.freedesktop.org/gstreamer/orc/-/blob/main/.gitlab-ci.yml
vs2019 amd64:
# Update from https://gitlab.freedesktop.org/gstreamer/gstreamer/container_registry
image: 'registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2023-04-21.0-main'
stage: 'build'
tags:
- 'docker'
- 'windows'
- '2022'
artifacts:
expire_in: '5 days'
when: 'always'
paths:
- "builddir/meson-logs/*txt"
variables:
# Make sure any failure in PowerShell scripts is fatal
ErrorActionPreference: 'Stop'
WarningPreference: 'Stop'
ARCH: 'amd64'
PLAT: 'Desktop'
before_script:
# Make sure meson is up to date, so we don't need to rebuild the image with each release
- pip3 install -U meson ninja
script:
# Gitlab executes PowerShell in docker, but VsDevCmd.bat is a batch script.
# Environment variables substitutions is done by PowerShell before calling
# cmd.exe, that's why we use $env:FOO instead of %FOO%
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH -app_platform=$env:PLAT &&
meson setup builddir &&
meson compile --verbose -C builddir"
# Update from:
# https://gitlab.freedesktop.org/gstreamer/cerbero/-/blob/main/.gitlab-ci.yml
# https://gitlab.freedesktop.org/gstreamer/orc/-/blob/main/.gitlab-ci.yml
macos x86_64:
stage: 'build'
tags:
- gst-macos-13
artifacts:
expire_in: '5 days'
when: 'always'
paths:
- "builddir/meson-logs/*txt"
before_script:
- pip3 install --upgrade pip
# Need to install certificates for python
- pip3 install --upgrade certifi
# Anther way to install certificates
- open /Applications/Python\ 3.8/Install\ Certificates.command
# Make sure meson and ninja are up to date
- pip3 install -U meson ninja
script:
- CERT_PATH=$(python3 -m certifi) && export SSL_CERT_FILE=${CERT_PATH} && export REQUESTS_CA_BUNDLE=${CERT_PATH}
- meson setup builddir
- meson compile --verbose -C builddir
# Update from:
# https://gitlab.freedesktop.org/gstreamer/cerbero/-/blob/main/.gitlab-ci.yml
# https://gitlab.freedesktop.org/gstreamer/orc/-/blob/main/.gitlab-ci.yml
ios arm64:
stage: 'build'
tags:
- gst-ios-16
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
expire_in: '5 days'
when: 'always'
paths:
- "builddir/meson-logs/*txt"
before_script:
- pip3 install --upgrade pip
# Need to install certificates for python
- pip3 install --upgrade certifi
# Anther way to install certificates
- open /Applications/Python\ 3.8/Install\ Certificates.command
# Make sure meson and ninja are up to date
- pip3 install -U meson ninja
script:
- CERT_PATH=$(python3 -m certifi) && export SSL_CERT_FILE=${CERT_PATH} && export REQUESTS_CA_BUNDLE=${CERT_PATH}
- |
cat > ios-cross-file.txt <<EOF
[host_machine]
system = 'darwin'
cpu_family = 'aarch64'
cpu = 'aarch64'
endian = 'little'
[properties]
c_args = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
objc_args = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
cpp_args = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
objcpp_args = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
c_link_args = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
objc_link_args = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
cpp_link_args = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
objcpp_link_args = ['-arch', 'arm64', '--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)', '-miphoneos-version-min=8.0']
[binaries]
ar = '$(xcrun --find --sdk iphoneos ar)'
c = '$(xcrun --find --sdk iphoneos clang)'
objc = '$(xcrun --find --sdk iphoneos clang)'
cpp = '$(xcrun --find --sdk iphoneos clang++)'
objcpp = '$(xcrun --find --sdk iphoneos clang++)'
ranlib = '$(xcrun --find --sdk iphoneos ranlib)'
strip = '$(xcrun --find --sdk iphoneos strip)'
pkgconfig = 'false'
cmake = 'false'
EOF
- meson setup --cross-file ios-cross-file.txt builddir
- meson compile --verbose -C builddir
# Update from:
# https://gitlab.freedesktop.org/gstreamer/cerbero/-/blob/main/.gitlab-ci.yml
# https://gitlab.freedesktop.org/gstreamer/orc/-/blob/main/.gitlab-ci.yml
android fedora arm64:
# Update from https://gitlab.freedesktop.org/gstreamer/cerbero/container_registry
image: 'registry.freedesktop.org/gstreamer/cerbero/amd64/android-fedora:2021-10-22.0-1.18'
stage: 'build'
artifacts:
expire_in: '5 days'
when: 'always'
paths:
- "builddir/meson-logs/*.txt"
before_script:
- dnf install -y python3-pip gcc ninja-build
- pip3 install --user meson
script:
- export PATH="$HOME/.local/bin:$PATH"
- |
cat > android-cross-file.txt <<EOF
[constants]
ndk_path = '/android/ndk'
toolchain = ndk_path + '/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android'
api = '28'
[host_machine]
system = 'android'
cpu_family = 'aarch64'
cpu = 'aarch64'
endian = 'little'
[properties]
sys_root = ndk_path + '/sysroot'
c_link_args = ['-fuse-ld=gold']
cpp_link_args = ['-fuse-ld=gold']
[binaries]
c = toolchain + api + '-clang'
cpp = toolchain + api + '-clang++'
ar = toolchain + '-ar'
strip = toolchain + '-strip'
EOF
- meson setup --cross-file android-cross-file.txt builddir
- meson compile --verbose -C builddir

View File

@ -1,9 +1,9 @@
About
=====
# About
This is meant to be a more Linux packaging friendly copy of the AudioProcessing
module from the WebRTC[1] project. The ideal case is that we make no changes to
the code to make tracking upstream code easy.
module from the [ WebRTC ](https://webrtc.googlesource.com/src) project. The
ideal case is that we make no changes to the code to make tracking upstream
code easy.
This package currently only includes the AudioProcessing bits, but I am very
open to collaborating with other projects that wish to distribute other bits of
@ -11,25 +11,33 @@ the code and hopefully eventually have a single point of packaging all the
WebRTC code to help people reuse the code and avoid keeping private copies in
several different projects.
[1] https://webrtc.googlesource.com/src
# Building
Feedback
========
This project uses the [Meson build system](https://mesonbuild.com/). The
quickest way to build is:
Patches, suggestions welcome. You can send them to the PulseAudio mailing
list[2] or to me at the address below.
```sh
# Initialise into the build/ directory, for a prefixed install into the
# install/ directory
meson . build -Dprefix=$PWD/install
-- Arun Raghavan <mail@arunraghavan.net>
# Run the actual build
ninja -C build
[2] http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
# Install locally
ninja -C build install
Notes
====
# The libraries, headers, and pkg-config files are now in the install/
# directory
```
1. Some files need to be patch to avoid pulling in the gtest framework. This
should ideally be pushed upstream in some way so we're able to just pull
in what we need without changing anything.
# Feedback
2. It might be nice to try LTO on the library. We build a lot of code as part
Patches, suggestions welcome. You can file an issue on our Gitlab
[repository](https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing/).
# Notes
1. It might be nice to try LTO on the library. We build a lot of code as part
of the main AudioProcessing module deps, and it's possible that this could
provide significant space savings.

View File

@ -25,16 +25,19 @@ git tag -s -m 'WebRTC AudioProcessing v<X.y>' v<X.y>
## Make a tarball
```sh
git archive --format 'tar.gz' \
--prefix webrtc-audio-processing-X.y -9 vX.y \
> webrtc-audio-processing-X.y.tar.gz
# The output will be in build/meson-dist/
meson dist -C build --formats=gztar,xztar --include-subprojects
```
## Checksum the tarball
## Do a test build
```sh
sha256sum webrtc-audio-processing-X.y.tar.gz \
> webrtc-audio-processing-X.y.tar.gz.sha256
tar xvf webrtc-audio-processing-X.y.tar.xz
cd webrtc-audio-processing-X.y
meson . build -Dprefix=$PWD/install
ninja -C build
ninja -C build install
cd ..
```
## Publish the files

View File

@ -1,10 +1,10 @@
project('webrtc-audio-processing-1', 'c', 'cpp',
version : '1.0',
meson_version : '>= 0.54',
project('webrtc-audio-processing', 'c', 'cpp',
version : '1.2',
meson_version : '>= 0.63',
default_options : [ 'warning_level=1',
'buildtype=debugoptimized',
'c_std=c11',
'cpp_std=c++14',
'cpp_std=c++17',
]
)
@ -27,33 +27,53 @@ ac_minor_version = minor_version
ac_version = ac_major_version + '.' + ac_minor_version
ac_project_name = 'webrtc-audio-coding-' + ac_major_version
include_subdir = meson.project_name()
include_subdir = apm_project_name
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
host_system = host_machine.system()
# Don't rely on the cross file setting the system properly when targeting ios
if host_system == 'darwin' and meson.is_cross_build()
ios_test_code = '''#include <TargetConditionals.h>
#if ! TARGET_OS_IPHONE
#error "Not iOS/tvOS/watchOS/iPhoneSimulator"
#endif'''
if cc.compiles(ios_test_code, name : 'building for iOS')
host_system = 'ios'
endif
endif
platform_cflags = []
os_cflags = []
os_deps = []
have_posix = false
have_win = false
# Let's use pkg-config if available. This will also fallback to the subproject
# if pkg-config is not found, which is really the most reliable way of building
# abseil due to strict C++ standard match requirements.
absl_dep = [
cpp.find_library('absl_base'),
cpp.find_library('absl_bad_optional_access'),
cpp.find_library('absl_flags_internal'),
cpp.find_library('absl_flags_marshalling'),
cpp.find_library('absl_flags_parse'),
cpp.find_library('absl_flags_registry'),
cpp.find_library('absl_flags_usage_internal'),
cpp.find_library('absl_raw_logging_internal'),
cpp.find_library('absl_strings'),
cpp.find_library('absl_synchronization'),
cpp.find_library('absl_throw_delegate'),
dependency('absl_base', default_options: ['cpp_std=c++17']),
dependency('absl_flags'),
dependency('absl_strings'),
dependency('absl_synchronization'),
dependency('absl_bad_optional_access'),
]
if absl_dep[0].type_name() == 'internal'
absl_subproj = subproject('abseil-cpp')
headers = [
absl_subproj.get_variable('absl_base_headers'),
absl_subproj.get_variable('absl_flags_headers'),
absl_subproj.get_variable('absl_strings_headers'),
absl_subproj.get_variable('absl_synchronization_headers'),
absl_subproj.get_variable('absl_types_headers'),
]
install_headers(headers, preserve_path: true)
endif
if ['darwin', 'ios'].contains(host_system)
os_cflags = ['-DWEBRTC_MAC']
if host_system == 'ios'
@ -72,6 +92,12 @@ elif host_system == 'linux'
have_posix = true
elif host_system == 'windows'
platform_cflags += ['-DWEBRTC_WIN', '-D_WIN32', '-U__STRICT_ANSI__']
# this one is for MinGW to get format specifiers from inttypes.h in C++
platform_cflags += ['-D__STDC_FORMAT_MACROS=1']
# Avoid min/max from windows.h which breaks std::min/max
platform_cflags += ['-DNOMINMAX']
# Ensure M_PI etc are defined
platform_cflags += ['-D_USE_MATH_DEFINES']
os_deps += [cc.find_library('winmm')]
have_win = true
endif
@ -88,8 +114,8 @@ have_mips = false
have_mips64 = false
have_x86 = false
have_avx2 = false
if ['arm', 'armv7'].contains(host_machine.cpu_family())
if cc.compiles('''#ifdef __ARM_ARCH_ISA_ARM
if host_machine.cpu_family() == 'arm'
if cc.compiles('''#ifndef __ARM_ARCH_ISA_ARM
#error no arm arch
#endif''')
have_arm = true
@ -124,14 +150,14 @@ if ['x86', 'x86_64'].contains(host_machine.cpu_family())
endif
neon_opt = get_option('neon')
if neon_opt != 'no'
if neon_opt != 'no' and not have_neon
if neon_opt != 'runtime'
if cc.compiles('#include <arm_neon.h>', args : '-mfpu=neon')
arch_cflags += ['-mfpu=neon', '-DWEBRTC_HAS_NEON']
have_neon = true
endif
else
neon_opt += ['-DWEBRTC_DETECT_NEON', '-mfpu=neon']
arch_cflags += ['-DWEBRTC_DETECT_NEON', '-mfpu=neon']
have_neon = true
endif
endif
@ -158,11 +184,20 @@ pkgconfig.generate(
extra_cflags: [
'-DWEBRTC_LIBRARY_IMPL',
] + platform_cflags,
libraries: libwebrtc_audio_processing,
libraries: [
libwebrtc_audio_processing,
],
requires: [
# the audio processing header references absl's optional.h
'absl_base',
]
)
audio_processing_dep = declare_dependency(link_with : libwebrtc_audio_processing,
include_directories : [webrtc_inc])
audio_processing_dep = declare_dependency(
link_with: libwebrtc_audio_processing,
dependencies: [absl_dep],
include_directories: [webrtc_inc]
)
meson.override_dependency(apm_project_name, audio_processing_dep)
@ -178,7 +213,9 @@ pkgconfig.generate(
libraries: libwebrtc_audio_coding,
)
audio_coding_dep = declare_dependency(link_with : libwebrtc_audio_coding,
include_directories : [webrtc_inc])
audio_coding_dep = declare_dependency(
link_with: libwebrtc_audio_coding,
include_directories: [webrtc_inc]
)
meson.override_dependency(ac_project_name, audio_coding_dep)

View File

@ -0,0 +1,84 @@
[wrap-file]
directory = abseil-cpp-20230125.1
source_url = https://github.com/abseil/abseil-cpp/archive/20230125.1.tar.gz
source_filename = abseil-cpp-20230125.1.tar.gz
source_hash = 81311c17599b3712069ded20cca09a62ab0bf2a89dfa16993786c8782b7ed145
patch_filename = abseil-cpp_20230125.1-4_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/abseil-cpp_20230125.1-4/get_patch
patch_hash = 112ee72052049d930396c2778fc1c6e184137905dd75d60a97dcfc386426610d
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/abseil-cpp_20230125.1-4/abseil-cpp-20230125.1.tar.gz
wrapdb_version = 20230125.1-4
[provide]
absl_base = absl_base_dep
absl_container = absl_container_dep
absl_debugging = absl_debugging_dep
absl_log = absl_log_dep
absl_flags = absl_flags_dep
absl_hash = absl_hash_dep
absl_crc = absl_crc_dep
absl_numeric = absl_numeric_dep
absl_profiling = absl_profiling_dep
absl_random = absl_random_dep
absl_status = absl_status_dep
absl_strings = absl_strings_dep
absl_synchronization = absl_synchronization_dep
absl_time = absl_time_dep
absl_types = absl_types_dep
absl_bad_any_cast_impl = absl_types_dep
absl_bad_optional_access = absl_types_dep
absl_bad_variant_access = absl_types_dep
absl_city = absl_hash_dep
absl_civil_time = absl_time_dep
absl_cord = absl_strings_dep
absl_cord_internal = absl_strings_dep
absl_cordz_functions = absl_strings_dep
absl_cordz_handle = absl_strings_dep
absl_cordz_info = absl_strings_dep
absl_cordz_sample_token = absl_strings_dep
absl_debugging_internal = absl_debugging_dep
absl_demangle_internal = absl_debugging_dep
absl_examine_stack = absl_debugging_dep
absl_exponential_biased = absl_profiling_dep
absl_failure_signal_handler = absl_debugging_dep
absl_flags_commandlineflag = absl_flags_dep
absl_flags_commandlineflag_internal = absl_flags_dep
absl_flags_config = absl_flags_dep
absl_flags_internal = absl_flags_dep
absl_flags_marshalling = absl_flags_dep
absl_flags_parse = absl_flags_dep
absl_flags_private_handle_accessor = absl_flags_dep
absl_flags_program_name = absl_flags_dep
absl_flags_reflection = absl_flags_dep
absl_flags_usage = absl_flags_dep
absl_flags_usage_internal = absl_flags_dep
absl_graphcycles_internal = absl_synchronization_dep
absl_hashtablez_sampler = absl_container_dep
absl_int128 = absl_numeric_dep
absl_leak_check = absl_debugging_dep
absl_log_severity = absl_base_dep
absl_low_level_hash = absl_hash_dep
absl_periodic_sampler = absl_profiling_dep
absl_random_distributions = absl_random_dep
absl_random_internal_distribution_test_util = absl_random_dep
absl_random_internal_platform = absl_random_dep
absl_random_internal_pool_urbg = absl_random_dep
absl_random_internal_randen = absl_random_dep
absl_random_internal_randen_hwaes = absl_random_dep
absl_random_internal_randen_hwaes_impl = absl_random_dep
absl_random_internal_randen_slow = absl_random_dep
absl_random_internal_seed_material = absl_random_dep
absl_random_seed_gen_exception = absl_random_dep
absl_random_seed_sequences = absl_random_dep
absl_raw_hash_set = absl_container_dep
absl_raw_logging_internal = absl_base_dep
absl_scoped_set_env = absl_base_dep
absl_spinlock_wait = absl_base_dep
absl_stacktrace = absl_debugging_dep
absl_statusor = absl_status_dep
absl_strerror = absl_base_dep
absl_str_format_internal = absl_strings_dep
absl_strings_internal = absl_strings_dep
absl_symbolize = absl_debugging_dep
absl_throw_delegate = absl_base_dep
absl_time_zone = absl_time_dep

View File

@ -1,3 +1,12 @@
isac_vad_sources = [
'codecs/isac/main/source/filter_functions.c',
'codecs/isac/main/source/isac_vad.c',
'codecs/isac/main/source/pitch_estimator.c',
'codecs/isac/main/source/pitch_filter.c',
]
isac_vad_dep = declare_dependency(sources: isac_vad_sources)
webrtc_audio_coding_sources = [
'codecs/isac/main/source/arith_routines.c',
'codecs/isac/main/source/arith_routines_hist.c',
@ -12,18 +21,14 @@ webrtc_audio_coding_sources = [
'codecs/isac/main/source/encode_lpc_swb.c',
'codecs/isac/main/source/entropy_coding.c',
'codecs/isac/main/source/filterbanks.c',
'codecs/isac/main/source/filter_functions.c',
'codecs/isac/main/source/intialize.c',
'codecs/isac/main/source/isac.c',
'codecs/isac/main/source/isac_vad.c',
'codecs/isac/main/source/lattice.c',
'codecs/isac/main/source/lpc_analysis.c',
'codecs/isac/main/source/lpc_gain_swb_tables.c',
'codecs/isac/main/source/lpc_shape_swb12_tables.c',
'codecs/isac/main/source/lpc_shape_swb16_tables.c',
'codecs/isac/main/source/lpc_tables.c',
'codecs/isac/main/source/pitch_estimator.c',
'codecs/isac/main/source/pitch_filter.c',
'codecs/isac/main/source/pitch_gain_tables.c',
'codecs/isac/main/source/pitch_lag_tables.c',
'codecs/isac/main/source/spectrum_ar_model_tables.c',
@ -32,7 +37,7 @@ webrtc_audio_coding_sources = [
libwebrtc_audio_coding = library(ac_project_name,
webrtc_audio_coding_sources,
dependencies: [base_dep, api_dep, common_audio_dep, system_wrappers_dep, fft_dep] + common_deps,
dependencies: [base_dep, api_dep, common_audio_dep, system_wrappers_dep, fft_dep, isac_vad_dep] + common_deps,
include_directories: webrtc_inc,
c_args: common_cflags,
cpp_args: common_cxxflags,
@ -40,12 +45,6 @@ libwebrtc_audio_coding = library(ac_project_name,
install: true
)
webrtc_audio_coding_dep = declare_dependency(
link_with: libwebrtc_audio_coding,
include_directories: webrtc_inc,
version: ac_version
)
install_headers(['codecs/isac/bandwidth_info.h'],
subdir: join_paths(include_subdir, 'modules', 'audio_coding', 'codecs', 'isac')
)

View File

@ -12,6 +12,7 @@
#define MODULES_AUDIO_PROCESSING_AEC3_REVERB_FREQUENCY_RESPONSE_H_
#include <array>
#include <memory>
#include <vector>
#include "absl/types/optional.h"

View File

@ -215,19 +215,4 @@ if (rtc_include_tests) {
deps += [ ":unittests_bundle_data" ]
}
}
rtc_executable("rnn_vad_tool") {
testonly = true
sources = [ "rnn_vad_tool.cc" ]
deps = [
":rnn_vad",
":rnn_vad_common",
"../../../../api:array_view",
"../../../../common_audio",
"../../../../rtc_base:rtc_base_approved",
"../../../../test:test_support",
"//third_party/abseil-cpp/absl/flags:flag",
"//third_party/abseil-cpp/absl/flags:parse",
]
}
}

View File

@ -1,120 +0,0 @@
/*
* Copyright (c) 2018 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 <array>
#include <string>
#include <vector>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "common_audio/resampler/push_sinc_resampler.h"
#include "common_audio/wav_file.h"
#include "modules/audio_processing/agc2/rnn_vad/common.h"
#include "modules/audio_processing/agc2/rnn_vad/features_extraction.h"
#include "modules/audio_processing/agc2/rnn_vad/rnn.h"
#include "rtc_base/logging.h"
ABSL_FLAG(std::string, i, "", "Path to the input wav file");
ABSL_FLAG(std::string, f, "", "Path to the output features file");
ABSL_FLAG(std::string, o, "", "Path to the output VAD probabilities file");
namespace webrtc {
namespace rnn_vad {
namespace test {
int main(int argc, char* argv[]) {
absl::ParseCommandLine(argc, argv);
rtc::LogMessage::LogToDebug(rtc::LS_INFO);
// Open wav input file and check properties.
const std::string input_wav_file = absl::GetFlag(FLAGS_i);
WavReader wav_reader(input_wav_file);
if (wav_reader.num_channels() != 1) {
RTC_LOG(LS_ERROR) << "Only mono wav files are supported";
return 1;
}
if (wav_reader.sample_rate() % 100 != 0) {
RTC_LOG(LS_ERROR) << "The sample rate rate must allow 10 ms frames.";
return 1;
}
RTC_LOG(LS_INFO) << "Input sample rate: " << wav_reader.sample_rate();
// Init output files.
const std::string output_vad_probs_file = absl::GetFlag(FLAGS_o);
FILE* vad_probs_file = fopen(output_vad_probs_file.c_str(), "wb");
FILE* features_file = nullptr;
const std::string output_feature_file = absl::GetFlag(FLAGS_f);
if (!output_feature_file.empty()) {
features_file = fopen(output_feature_file.c_str(), "wb");
}
// Initialize.
const size_t frame_size_10ms =
rtc::CheckedDivExact(wav_reader.sample_rate(), 100);
std::vector<float> samples_10ms;
samples_10ms.resize(frame_size_10ms);
std::array<float, kFrameSize10ms24kHz> samples_10ms_24kHz;
PushSincResampler resampler(frame_size_10ms, kFrameSize10ms24kHz);
FeaturesExtractor features_extractor;
std::array<float, kFeatureVectorSize> feature_vector;
RnnBasedVad rnn_vad;
// Compute VAD probabilities.
while (true) {
// Read frame at the input sample rate.
const auto read_samples =
wav_reader.ReadSamples(frame_size_10ms, samples_10ms.data());
if (read_samples < frame_size_10ms) {
break; // EOF.
}
// Resample input.
resampler.Resample(samples_10ms.data(), samples_10ms.size(),
samples_10ms_24kHz.data(), samples_10ms_24kHz.size());
// Extract features and feed the RNN.
bool is_silence = features_extractor.CheckSilenceComputeFeatures(
samples_10ms_24kHz, feature_vector);
float vad_probability =
rnn_vad.ComputeVadProbability(feature_vector, is_silence);
// Write voice probability.
RTC_DCHECK_GE(vad_probability, 0.f);
RTC_DCHECK_GE(1.f, vad_probability);
fwrite(&vad_probability, sizeof(float), 1, vad_probs_file);
// Write features.
if (features_file) {
const float float_is_silence = is_silence ? 1.f : 0.f;
fwrite(&float_is_silence, sizeof(float), 1, features_file);
if (is_silence) {
// Do not write uninitialized values.
feature_vector.fill(0.f);
}
fwrite(feature_vector.data(), sizeof(float), kFeatureVectorSize,
features_file);
}
}
// Close output file(s).
fclose(vad_probs_file);
RTC_LOG(LS_INFO) << "VAD probabilities written to " << output_vad_probs_file;
if (features_file) {
fclose(features_file);
RTC_LOG(LS_INFO) << "features written to " << output_feature_file;
}
return 0;
}
} // namespace test
} // namespace rnn_vad
} // namespace webrtc
int main(int argc, char* argv[]) {
return webrtc::rnn_vad::test::main(argc, argv);
}

View File

@ -88,7 +88,6 @@ webrtc_audio_processing_sources = [
'agc2/rnn_vad/pitch_search.cc',
'agc2/rnn_vad/pitch_search_internal.cc',
'agc2/rnn_vad/rnn.cc',
'agc2/rnn_vad/rnn_vad_tool.cc',
'agc2/rnn_vad/spectral_features.cc',
'agc2/rnn_vad/spectral_features_internal.cc',
'agc2/saturation_protector.cc',
@ -199,7 +198,7 @@ libwebrtc_audio_processing = library(apm_project_name,
dependencies: [
base_dep,
api_dep,
webrtc_audio_coding_dep,
isac_vad_dep,
system_wrappers_dep,
common_audio_dep,
pffft_dep,
@ -212,9 +211,3 @@ libwebrtc_audio_processing = library(apm_project_name,
soversion: apm_minor_version,
install: true
)
webrtc_audio_processing_dep = declare_dependency(
link_with: libwebrtc_audio_processing,
include_directories: webrtc_inc,
version: apm_version
)

View File

@ -12,6 +12,7 @@
#define MODULES_AUDIO_PROCESSING_TRANSIENT_FILE_UTILS_H_
#include <string.h>
#include <cstdint>
#include "rtc_base/system/file_wrapper.h"

View File

@ -15,6 +15,7 @@
#if RTC_LOG_ENABLED()
#if defined(WEBRTC_WIN)
#include <winsock2.h>
#include <windows.h>
#if _MSC_VER < 1900
#define snprintf _snprintf

View File

@ -51,9 +51,24 @@ foreach h : base_headers
)
endforeach
base_os_deps = []
if host_system == 'darwin'
base_os_deps += dependency('appleframeworks', modules: [ 'Foundation' ])
elif host_system == 'ios'
base_os_deps += dependency('appleframeworks',
modules: [
'CFNetwork',
'Foundation',
'Security',
'SystemConfiguration',
'UIKit',
]
)
endif
libbase = static_library('libbase',
base_sources,
dependencies: common_deps,
dependencies: common_deps + base_os_deps,
include_directories: webrtc_inc,
cpp_args : common_cxxflags
)

View File

@ -99,11 +99,13 @@ void SetCurrentThreadName(const char* name) {
#pragma warning(push)
#pragma warning(disable : 6320 6322)
#ifndef __MINGW32__
__try {
::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(ULONG_PTR),
reinterpret_cast<ULONG_PTR*>(&threadname_info));
} __except (EXCEPTION_EXECUTE_HANDLER) { // NOLINT
}
#endif
#pragma warning(pop)
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name)); // NOLINT

View File

@ -11,7 +11,7 @@
#ifndef RTC_BASE_SYNCHRONIZATION_RW_LOCK_WIN_H_
#define RTC_BASE_SYNCHRONIZATION_RW_LOCK_WIN_H_
#include <Windows.h>
#include <windows.h>
#include "rtc_base/synchronization/rw_lock_wrapper.h"

View File

@ -27,6 +27,13 @@
#define WEBRTC_ARCH_ARM_FAMILY
#define WEBRTC_ARCH_64_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN
#elif defined(__riscv) || defined(__riscv__)
#define WEBRTC_ARCH_LITTLE_ENDIAN
#if __riscv_xlen == 64
#define WEBRTC_ARCH_64_BITS
#else
#define WEBRTC_ARCH_32_BITS
#endif
#elif defined(_M_IX86) || defined(__i386__)
#define WEBRTC_ARCH_X86_FAMILY
#define WEBRTC_ARCH_X86

View File

@ -14,7 +14,7 @@
#include <cerrno>
#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#else
#include <string.h>
#endif

View File

@ -14,7 +14,11 @@
namespace webrtc {
#if defined(WEBRTC_ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
/* webrtc-audio-processing:
* We don't support the Android SDK integration for this, so stub out
void WarnThatTheCurrentThreadIsProbablyDeadlocked();
*/
inline void WarnThatTheCurrentThreadIsProbablyDeadlocked() {}
#else
inline void WarnThatTheCurrentThreadIsProbablyDeadlocked() {}
#endif