Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 85 additions & 82 deletions .github/workflows/webrtc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:
workflow_dispatch:
inputs:
webrtc_commit:
description: 'Specify WebRTC commit to build.'
description: 'WebRTC src commit (full or short).'
required: false
default: '60e674842ebae283cc6b2627f4b6f2f8186f3317' # Date: Wed Apr 7 19:12:13 2021 +0200
default: 'e8b4d4c5952a8fb7b35c2a6cba4e8c3de2ea2e1e'
depot_tools_commit:
description: 'Specify Depot Tools commit to to use for the build.'
description: 'depot_tools commit (override pin in webrtc_build.sh).'
required: false
default: 'e1a98941d3ab10549be6d82d0686bb0fb91ec903' # Date: Wed Apr 7 21:35:29 2021 +0000
default: '10eda50a3fd9c34ad8d31ec74e5f4eb5823d60f6'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -20,29 +20,35 @@ concurrency:
env:
WEBRTC_COMMIT: ${{ github.event.inputs.webrtc_commit }}
DEPOT_TOOLS_COMMIT: ${{ github.event.inputs.depot_tools_commit }}
WEBRTC_WORK_ROOT: ${{ github.workspace }}/..
GCLIENT_JOBS: 8

jobs:

Unix:
permissions:
contents: write # upload
contents: read
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-13]
include:
- os: ubuntu-22.04
package_suffix: linux_cxx-abi-1
- os: macos-14
package_suffix: macos_arm64

steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Set up Python version
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.10
python-version: '3.10'

- name: Install dependencies
if: ${{ matrix.os == 'ubuntu-22.04' }}
- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
run: |
source 3rdparty/webrtc/webrtc_build.sh
install_dependencies_ubuntu
Expand All @@ -60,116 +66,113 @@ jobs:
- name: Upload WebRTC
uses: actions/upload-artifact@v4
with:
name: webrtc_release_${{ matrix.os }}
name: webrtc_${{ matrix.package_suffix }}
path: |
webrtc_*.tar.gz
checksum_*.txt
webrtc_*.tar.gz
checksum_webrtc_*.tar.gz
if-no-files-found: error

Windows:
permissions:
contents: write # upload
# https://chromium.googlesource.com/chromium/src/+/HEAD/docs/windows_build_instructions.md
contents: read
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
include:
- config: Release
static_runtime: ON
tag: Release_mt
- config: Release
static_runtime: OFF
tag: Release_md
- config: Debug
static_runtime: ON
tag: Debug_mt
- config: Debug
static_runtime: OFF
tag: Debug_md
env:
WORK_DIR: "C:\\WebRTC" # Not enough space in D:
OPEN3D_DIR: "D:\\a\\open3d\\open3d"
DEPOT_TOOLS_UPDATE: 1 # Fix cannot find python3_bin_reldir.txt
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
NPROC: 2
WORK_DIR: 'C:\WebRTC'
OPEN3D_DIR: ${{ github.workspace }}
WEBRTC_WORK_ROOT: 'C:\WebRTC'
DEPOT_TOOLS_UPDATE: 0 # belt-and-suspenders; also set by webrtc_setup_path
DEPOT_TOOLS_WIN_TOOLCHAIN: 0 # use locally installed VS, not the Chromium toolchain

steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Set up Python version
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Disk space
- name: Prepare work directory
shell: pwsh
run: |
Get-PSDrive
mkdir "$env:WORK_DIR"
New-Item -ItemType Directory -Force -Path $env:WORK_DIR

- name: Setup PATH for Visual Studio # Required for Ninja
- name: Setup PATH for Visual Studio
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Download WebRTC sources
shell: pwsh
working-directory: ${{ env.WORK_DIR }}
# shell: bash uses Git Bash on Windows, which transparently converts
# Windows-style env paths (e.g. OPEN3D_DIR, WEBRTC_WORK_ROOT) so they
# work in bash string and pushd contexts.
shell: bash
run: |
$ErrorActionPreference = 'Stop'
echo "Get depot_tools"
# Checkout to a specific version
# Ref: https://chromium.googlesource.com/chromium/src/+/main/docs/building_old_revisions.md
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
git -C depot_tools checkout $env:DEPOT_TOOLS_COMMIT
$env:Path = (Get-Item depot_tools).FullName + ";" + $env:Path

echo "Get WebRTC"
mkdir webrtc
cd webrtc
fetch webrtc

git -C src checkout $env:WEBRTC_COMMIT
git -C src submodule update --init --recursive
echo "gclient sync"
gclient sync -D --force --reset
cd ..
echo "random.org"
curl "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" -o skipcache
source "$OPEN3D_DIR/3rdparty/webrtc/webrtc_build.sh"
download_webrtc_sources

- name: Patch WebRTC
shell: pwsh
working-directory: ${{ env.WORK_DIR }}
run: |
$ErrorActionPreference = 'Stop'
cp "$env:OPEN3D_DIR/3rdparty/webrtc/CMakeLists.txt" webrtc/
cp "$env:OPEN3D_DIR/3rdparty/webrtc/webrtc_common.cmake" webrtc/

- name: Build WebRTC (Release)
working-directory: ${{ env.WORK_DIR }}
run: |
$ErrorActionPreference = 'Stop'
$env:Path = (Get-Item depot_tools).FullName + ";" + $env:Path
mkdir webrtc/build
cd webrtc/build
cmake -G Ninja -D CMAKE_BUILD_TYPE=Release `
-D CMAKE_INSTALL_PREFIX=${{ env.WORK_DIR }}/webrtc_release/Release `
..
ninja install
echo "Cleanup build folder for next config build"
cd ..
rm -r build
Copy-Item "$env:OPEN3D_DIR/3rdparty/webrtc/CMakeLists.txt" webrtc/
Copy-Item "$env:OPEN3D_DIR/3rdparty/webrtc/webrtc_common.cmake" webrtc/
bash "$env:OPEN3D_DIR/3rdparty/webrtc/apply_webrtc_patches.sh" `
"$env:OPEN3D_DIR" "$env:WORK_DIR/webrtc/src"

- name: Build WebRTC (Debug)
- name: Build and package WebRTC
shell: pwsh
working-directory: ${{ env.WORK_DIR }}
env:
BUILD_CONFIG: ${{ matrix.config }}
STATIC_RT: ${{ matrix.static_runtime }}
WIN_TAG: ${{ matrix.tag }}
run: |
$ErrorActionPreference = 'Stop'
$env:Path = (Get-Item depot_tools).FullName + ";" + $env:Path
mkdir webrtc/build
cd webrtc/build
cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug `
-D CMAKE_INSTALL_PREFIX=${{ env.WORK_DIR }}/webrtc_release/Debug `
..
$env:Path = (Get-Item depot_tools).FullName + ';' + $env:Path
$installRoot = Join-Path $env:WORK_DIR "webrtc_pkg"
if (Test-Path $installRoot) { Remove-Item -Recurse -Force $installRoot }
New-Item -ItemType Directory -Force -Path webrtc/build | Out-Null
Push-Location webrtc/build
$debugFlag = if ($env:BUILD_CONFIG -eq 'Debug') { 'ON' } else { 'OFF' }
cmake -G Ninja `
-D CMAKE_BUILD_TYPE=$env:BUILD_CONFIG `
-D WEBRTC_IS_DEBUG=$debugFlag `
-D WEBRTC_STATIC_MSVC_RUNTIME=$env:STATIC_RT `
-D CMAKE_INSTALL_PREFIX=$installRoot `
..
ninja install

- name: Package WebRTC
working-directory: ${{ env.WORK_DIR }}
run: |
$ErrorActionPreference = 'Stop'
$env:WEBRTC_COMMIT_SHORT = (git -C webrtc/src rev-parse --short=7 HEAD)
cmake -E tar cv webrtc_${env:WEBRTC_COMMIT_SHORT}_win.zip `
--format=zip -- webrtc_release
cmake -E sha256sum webrtc_${env:WEBRTC_COMMIT_SHORT}_win.zip | Tee-Object -FilePath checksum_win.txt
Pop-Location
$short = (git -C webrtc/src rev-parse --short=7 HEAD)
$zip = "webrtc_${short}_win_$env:WIN_TAG.zip"
Push-Location $installRoot
cmake -E tar cvf (Join-Path $env:OPEN3D_DIR $zip) --format=zip .
Pop-Location
cmake -E sha256sum (Join-Path $env:OPEN3D_DIR $zip) | Tee-Object -FilePath (Join-Path $env:OPEN3D_DIR "checksum_$zip")

- name: Upload WebRTC
uses: actions/upload-artifact@v4
with:
name: webrtc_release_windows
name: webrtc_win_${{ matrix.tag }}
path: |
${{ env.WORK_DIR }}/webrtc_*.zip
${{ env.WORK_DIR }}/checksum_*.txt
webrtc_*_win_*.zip
checksum_webrtc_*_win_*.zip
if-no-files-found: error
5 changes: 4 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ jobs:
- BUILD_CUDA_MODULE: ON # FIXME
CONFIG: Debug
env:
BUILD_WEBRTC: ${{ ( matrix.BUILD_SHARED_LIBS == 'OFF' && matrix.STATIC_RUNTIME == 'ON' ) && 'ON' || 'OFF' }}
# WebRTC prebuilt ships static libs for both MSVC runtimes (/MT, /MD).
# Enable it for static-lib + static-runtime (/MT) and shared-lib +
# dynamic-runtime (/MD). Shared libs always use the dynamic runtime.
BUILD_WEBRTC: ${{ ( ( matrix.BUILD_SHARED_LIBS == 'OFF' && matrix.STATIC_RUNTIME == 'ON' ) || ( matrix.BUILD_SHARED_LIBS == 'ON' && matrix.STATIC_RUNTIME == 'OFF' ) ) && 'ON' || 'OFF' }}
BUILD_PYTORCH_OPS: ${{ ( matrix.BUILD_CUDA_MODULE == 'ON' || matrix.CONFIG == 'Debug' ) && 'OFF' || 'ON' }} # FIXME

steps:
Expand Down
17 changes: 15 additions & 2 deletions 3rdparty/find_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1988,11 +1988,24 @@ if(BUILD_WEBRTC)
open3d_import_3rdparty_library(3rdparty_webrtc
HIDDEN
INCLUDE_DIRS ${WEBRTC_INCLUDE_DIRS}
LIB_DIR ${WEBRTC_LIB_DIR}
LIBRARIES ${WEBRTC_LIBRARIES}
DEPENDS ext_webrtc_all
)
if(UNIX AND NOT APPLE)
target_link_libraries(3rdparty_webrtc INTERFACE
"-Wl,--whole-archive"
"$<BUILD_INTERFACE:${WEBRTC_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}webrtc${CMAKE_STATIC_LIBRARY_SUFFIX}>"
"-Wl,--no-whole-archive"
"$<BUILD_INTERFACE:${WEBRTC_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}webrtc_extra${CMAKE_STATIC_LIBRARY_SUFFIX}>")
else()
target_link_libraries(3rdparty_webrtc INTERFACE
"$<BUILD_INTERFACE:${WEBRTC_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}webrtc${CMAKE_STATIC_LIBRARY_SUFFIX}>"
"$<BUILD_INTERFACE:${WEBRTC_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}webrtc_extra${CMAKE_STATIC_LIBRARY_SUFFIX}>")
endif()
target_link_libraries(3rdparty_webrtc INTERFACE Open3D::3rdparty_threads ${CMAKE_DL_LIBS})
# libwebrtc.a and libturbojpeg.a both export jpeg_* symbols (WebRTC bundles libjpeg).
if(UNIX AND NOT APPLE)
target_link_options(3rdparty_webrtc INTERFACE "LINKER:--allow-multiple-definition")
endif()
if (MSVC) # https://github.com/iimachines/webrtc-build/issues/2#issuecomment-503535704
target_link_libraries(3rdparty_webrtc INTERFACE secur32 winmm dmoguids wmcodecdspuuid msdmo strmiids)
endif()
Expand Down
24 changes: 5 additions & 19 deletions 3rdparty/webrtc/0001-build-enable-rtc_use_cxx11_abi-option.patch
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
From c47a1b6c0faa2206395647cb83cb1a0542101847 Mon Sep 17 00:00:00 2001
From: Yixing Lao <yixing.lao@gmail.com>
Date: Wed, 7 Apr 2021 16:17:39 -0700
Subject: [PATCH] build: enable rtc_use_cxx11_abi option

---
config/BUILDCONFIG.gn | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn
index 0ef73ab2b..5ab677e27 100644
--- a/config/BUILDCONFIG.gn
+++ b/config/BUILDCONFIG.gn
@@ -163,6 +163,12 @@ declare_args() {
is_component_build = is_debug && current_os != "ios"
@@ -171,6 +171,11 @@ declare_args() {
is_debug && current_os != "ios" && current_os != "watchos"
}

+declare_args() {
+ # Set to false to define "_GLIBCXX_USE_CXX11_ABI=0". If set to true, the
+ # default will be used, which corresponds to the new CXX11 ABI.
+ # Open3D: GCC libstdc++ ABI selection on Linux.
+ rtc_use_cxx11_abi = true
+}
+
assert(!(is_debug && is_official_build), "Can't do official debug builds")

# ==============================================================================
--
2.17.1

assert(!(current_os == "ios" && is_component_build),
"Can't use component build on iOS")
12 changes: 12 additions & 0 deletions 3rdparty/webrtc/0002-src-fix-nullptr_t-with-libstdcxx.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/rtc_base/ssl_stream_adapter.h b/rtc_base/ssl_stream_adapter.h
--- a/rtc_base/ssl_stream_adapter.h
+++ b/rtc_base/ssl_stream_adapter.h
@@ -129,7 +129,7 @@ class SSLStreamAdapter : public StreamInterface {
static std::unique_ptr<SSLStreamAdapter> Create(
std::unique_ptr<StreamInterface> stream,
absl::AnyInvocable<void(SSLHandshakeError)> handshake_error,
- nullptr_t /*field_trials*/) {
+ std::nullptr_t /*field_trials*/) {
return Create(std::move(stream), std::move(handshake_error));
}

18 changes: 18 additions & 0 deletions 3rdparty/webrtc/0003-src-gcc-suppress-port-interface-network.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/p2p/base/port_interface.h b/p2p/base/port_interface.h
--- a/p2p/base/port_interface.h
+++ b/p2p/base/port_interface.h
@@ -52,7 +52,14 @@ class PortInterface {
virtual ~PortInterface();

virtual IceCandidateType Type() const = 0;
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wchanges-meaning"
+#endif
virtual const Network* Network() const = 0;
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif

// Methods to set/get ICE role and tiebreaker values.
virtual void SetIceRole(IceRole role) = 0;
21 changes: 21 additions & 0 deletions 3rdparty/webrtc/0004-call-payload_type_picker-gcc-flat_tree.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/call/payload_type_picker.cc b/call/payload_type_picker.cc
--- a/call/payload_type_picker.cc
+++ b/call/payload_type_picker.cc
@@ -338,7 +338,7 @@
RTCError RtpHeaderExtensionRecorder::AddMapping(int id,
absl::string_view uri,
bool encrypt) {
- auto it = uri_to_id_.find(std::pair{uri, encrypt});
+ auto it = uri_to_id_.find(std::pair{std::string(uri), encrypt});
if (it != uri_to_id_.end()) {
if (it->second != id) {
// TODO: https://issues.webrtc.org/41480892 - This will return an error in
@@ -354,7 +354,7 @@

RTCErrorOr<int> RtpHeaderExtensionRecorder::LookupId(absl::string_view uri,
bool encrypt) const {
- auto it = uri_to_id_.find(std::pair{uri, encrypt});
+ auto it = uri_to_id_.find(std::pair{std::string(uri), encrypt});
if (it == uri_to_id_.end()) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"No ID found for extension");
Loading
Loading