Delay estimation logic extracted from WebRTC.
This repository uses CMake
to automate cross-platform builds. If it fails to build, please create an issue with the following informations:
- CMake version
- Platform (operating system with CPU architecture)
- Compiler name and version
- Error message produced by CMake
- Install Visual Studio and CMake. For Visual Studio 2017 and newer, instead of installing CMake by yourself, you can install a Visual Studio component called
Visual C++ Tools for CMake
, which greatly simplifies the process. If you are using an older version of Visual Studio, install standalone CMake.
- Clone this repository with submodules.
git clone --recurse-submodules https://github.com/RangHo/webrtc-delay-estimation
- You can open the project by clicking File > Open > Folder in Visual Studio, and selecting the
webrtc-delay-estimation
folder you just cloned. Visual Studio should recognizeCMakeLists.txt
automatically. You can build the project as if it is a regular Visual Studio project.
- For older versions of Visual Studio, you need to use CMake command line to generate project files. Generate
.vcxproj
files using the following command. Replace<generator>
with the name of Visual Studio generator matching the version of Visual Studio you are using.
mkdir build
cd build
cmake -G "<generator>" ..
- Open the
.sln
file CMake created, and build the solution.
- Install CMake. For most distributions, there should be a package for your default package manager.
# Ubuntu
sudo apt-get install cmake
# Arch Linux
sudo pacman -S cmake
# Homebrew
brew install cmake
- Clone the repository and
cd
into it.
git clone --recurse-submodules https://github.com/RangHo/webrtc-delay-estimation
cd webrtc-delay-estimation
- Create a build directory and build.
mkdir build && cd build
cmake ..
cmake --build . --target webrtc-delay-estimation
This repository provides 3 CMake targets as follows:
webrtc-delay-estimation
: A static library exposing delay estimation function as declared ininclude/webrtc-delay-estimation.h
delay-estimator
: An executable that uses the library above to estimate delay in between two WAV fileswebrtc-delay-estimation-tests
: A testing executable that generates random samples and tries to estimate delay using them
This library exposes the extracted WebRTC components and an additional helper function. By default, linking this library using CMake's target_link_libraries
directive includes definition for the helper function only. To access raw WebRTC components, copy the relevant .h
files from src/
directory.
Example CMakeLists.txt
file would look like:
add_executable (my-executable
"main.cc"
# ...
)
target_link_libraries (my-executable PRIVATE
webrtc-delay-estimation
)
This command line utility uses webrtc-delay-estimation
library above to find delay from two different WAV files. Unless given a -v
switch, the program will write the estimated delay in samples to stdout
. It takes two positional arguments: render
and capture
. The former is the WAV file of the far end, and the latter is the WAV file captured by the local microphone.
delay-estimator [-hv] [-f integer] [-d {2,4,8}] /path/to/render /path/to/capture
- (required, positional)
/path/to/render
: path to the render WAV file. - (required, positional)
/path/to/capture
: path to the capture WAV file. - (optional)
-h
or--help
: displays help message. - (optional)
-v
or--verbose
: show additional information when executing the program. - (optional)
-f integer
or--filter integer
: Useinteger
number of filters when estimating delay. (default: 10) - (optional)
-d {2,4,8}
or--downsampling-factor {2,4,8}
: sets the down sampling factor. The factor can be either 2, 4, or 8. (default: 8)
This target builds a testing binary using Catch2 testing framework. Build and run the binary to test the functionality of the library.
# You can run the binary directly
cd build/tests
./webrtc-delay-estimation-tests
# ... or you can just use ctest to automate things
ctest