Skip to content

Commit 51a5755

Browse files
committed
Improve bundled Opus build and packet handling
1 parent ba0bb57 commit 51a5755

31 files changed

Lines changed: 4492 additions & 498 deletions

.github/workflows/ci.yml

Lines changed: 83 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: CI
22

3+
permissions:
4+
contents: read
5+
36
on:
47
push:
58
branches:
@@ -11,7 +14,7 @@ jobs:
1114
name: Rustfmt
1215
runs-on: ubuntu-latest
1316
steps:
14-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v6
1518
- name: Install Rust
1619
uses: dtolnay/rust-toolchain@stable
1720
- name: cargo fmt
@@ -21,7 +24,7 @@ jobs:
2124
name: Clippy
2225
runs-on: ubuntu-latest
2326
steps:
24-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@v6
2528
- name: Install Rust
2629
uses: dtolnay/rust-toolchain@stable
2730
- name: cargo clippy
@@ -31,7 +34,7 @@ jobs:
3134
name: Cargo Check
3235
runs-on: ubuntu-latest
3336
steps:
34-
- uses: actions/checkout@v4
37+
- uses: actions/checkout@v6
3538
- name: Install Rust
3639
uses: dtolnay/rust-toolchain@stable
3740
- name: cargo check
@@ -41,7 +44,7 @@ jobs:
4144
name: MSRV Check
4245
runs-on: ubuntu-latest
4346
steps:
44-
- uses: actions/checkout@v4
47+
- uses: actions/checkout@v6
4548
- name: Install Rust
4649
uses: dtolnay/rust-toolchain@1.87.0
4750
- name: cargo check
@@ -53,9 +56,9 @@ jobs:
5356
strategy:
5457
fail-fast: false
5558
matrix:
56-
os: [ubuntu-latest, macos-latest, windows-latest]
59+
os: [ubuntu-latest, macos-latest, windows-2025-vs2026]
5760
steps:
58-
- uses: actions/checkout@v4
61+
- uses: actions/checkout@v6
5962
- name: Install Rust
6063
uses: dtolnay/rust-toolchain@stable
6164
- name: Install ffmpeg (Ubuntu)
@@ -67,18 +70,39 @@ jobs:
6770
if: matrix.os == 'macos-latest'
6871
run: brew install ffmpeg
6972
- name: Install ffmpeg (Windows)
70-
if: matrix.os == 'windows-latest'
73+
if: startsWith(matrix.os, 'windows-')
7174
shell: pwsh
7275
run: choco install ffmpeg --no-progress -y
7376
- name: cargo test
7477
run: cargo test
7578

79+
windows-static-crt:
80+
name: Windows Static CRT
81+
runs-on: windows-2025-vs2026
82+
env:
83+
CARGO_TARGET_DIR: target/ci-windows-static-crt
84+
CRT_VERIFY_TARGET: x86_64-pc-windows-msvc
85+
RUSTFLAGS: -C target-feature=+crt-static
86+
steps:
87+
- uses: actions/checkout@v6
88+
- name: Install Rust
89+
uses: dtolnay/rust-toolchain@stable
90+
with:
91+
targets: x86_64-pc-windows-msvc
92+
- name: Install ffmpeg
93+
shell: pwsh
94+
run: choco install ffmpeg --no-progress -y
95+
- name: Verify static CRT imports
96+
run: python scripts/verify_windows_static_crt.py
97+
- name: cargo test (static CRT)
98+
run: cargo test --target x86_64-pc-windows-msvc
99+
76100
avx-presume:
77101
name: AVX presume feature
78102
runs-on: ubuntu-latest
79103
needs: [fmt, clippy, check, tests]
80104
steps:
81-
- uses: actions/checkout@v4
105+
- uses: actions/checkout@v6
82106
- name: Install Rust
83107
uses: dtolnay/rust-toolchain@stable
84108
- name: Verify AVX presume gating
@@ -88,23 +112,71 @@ jobs:
88112
name: System Library
89113
runs-on: ubuntu-latest
90114
needs: [fmt, clippy, check, tests]
115+
env:
116+
CARGO_TARGET_DIR: target/ci-system-lib
117+
OPUS_SYSTEM_BUILD_DIR: ${{ runner.temp }}/opus-system-build
118+
OPUS_SYSTEM_PREFIX: ${{ runner.temp }}/opus-system
119+
PKG_CONFIG_PATH: ${{ runner.temp }}/opus-system/lib/pkgconfig
91120
steps:
92-
- uses: actions/checkout@v4
121+
- uses: actions/checkout@v6
93122
- name: Install Rust
94123
uses: dtolnay/rust-toolchain@stable
95124
- name: Install build dependencies
96125
run: |
97126
sudo apt-get update
98-
sudo apt-get install -y pkg-config ffmpeg curl build-essential autoconf automake libtool cmake
127+
sudo apt-get install -y build-essential cmake pkg-config ffmpeg
128+
- name: Install pinned Opus system library
129+
run: |
130+
# The git subtree has no standalone metadata for CMake to derive its release version.
131+
cmake \
132+
-S opus \
133+
-B "$OPUS_SYSTEM_BUILD_DIR" \
134+
-DCMAKE_BUILD_TYPE=Release \
135+
-DCMAKE_INSTALL_PREFIX="$OPUS_SYSTEM_PREFIX" \
136+
-DCMAKE_INSTALL_LIBDIR=lib \
137+
-DOPUS_PACKAGE_VERSION=1.5.2 \
138+
-DOPUS_BUILD_SHARED_LIBRARY=OFF \
139+
-DOPUS_BUILD_TESTING=OFF \
140+
-DOPUS_BUILD_PROGRAMS=OFF \
141+
-DOPUS_DRED=OFF \
142+
-DBUILD_SHARED_LIBS=OFF
143+
cmake --build "$OPUS_SYSTEM_BUILD_DIR" --parallel
144+
cmake --install "$OPUS_SYSTEM_BUILD_DIR"
99145
- name: Verify system lib build and tests
100146
run: python scripts/verify_system_lib.py
101147

148+
asan:
149+
name: ASan + LeakSanitizer (bundled)
150+
runs-on: ubuntu-latest
151+
env:
152+
ASAN_OPTIONS: detect_leaks=1:halt_on_error=1
153+
CARGO_TARGET_DIR: target/ci-asan
154+
CC: clang
155+
CFLAGS: -fsanitize=address -fno-omit-frame-pointer
156+
RUSTFLAGS: -Zsanitizer=address
157+
steps:
158+
- uses: actions/checkout@v6
159+
- name: Install nightly Rust
160+
uses: dtolnay/rust-toolchain@nightly
161+
with:
162+
targets: x86_64-unknown-linux-gnu
163+
- name: Install sanitizer test dependencies
164+
run: |
165+
sudo apt-get update
166+
sudo apt-get install -y clang llvm ffmpeg wget
167+
- name: Test Rust and bundled C with ASan and leak detection
168+
run: >-
169+
cargo +nightly test
170+
--target x86_64-unknown-linux-gnu
171+
--features dred
172+
--all-targets
173+
102174
dred:
103175
name: DRED (bundled)
104176
runs-on: ubuntu-latest
105177
needs: [fmt, clippy, check, tests]
106178
steps:
107-
- uses: actions/checkout@v4
179+
- uses: actions/checkout@v6
108180
- name: Install Rust
109181
uses: dtolnay/rust-toolchain@stable
110182
- name: Install deps (ffmpeg + wget for model download)

0 commit comments

Comments
 (0)