Repository navigation
rust: Port libobs/media-io/audio-io.c to obs-media-io on Windows - #745
Merged
Merged
Conversation
nathan-v
marked this pull request as ready for review
October 14, 2026 18:17
Refs obs-rust#728 open_getters_stereo asserts audio_output_open returns 0 and gets AUDIO_OUTPUT_FAIL (-2), because the Windows RecursiveMutex::init stub returns an error.
Refs obs-rust#728 The worker lock is a recursive CRITICAL_SECTION, and the thread registers the MMCSS Audio task. ENABLE_RUST_LIBOBS drops media-io/audio-io.c on Windows too. Tier 1 (audio_io, audio_io_core) and Tier 3 (audio_io_parity) pass on x86_64-pc-windows-msvc. Breaking RecursiveMutex::init so it returns an error makes getters_match fail with "rust open: -2"; that break was reverted.
soldr cargo dylint on this host never starts rustc and spawns short-lived rustup.exe processes. Copying the driver to a .exe name did not stop it.
Darwin cross clippy on this host dies while unpacking the SDK (symlink privilege 1314, then path length 206). The MSVC target in that loop passed.
This repo does not keep a lessons file.
audio-io.c includes <Windows.h>. The Ubuntu windows-gnu link compiles that with a case-sensitive MinGW, which only has windows.h. A wrapper searched first forwards the capital name. Refs obs-rust#728 Local-Gate: v1 tree=99d8f537a30ffc1191f65f531a0c15db1060fe46 secs=512 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run Ci-Attestation: {"at":1792006022,"gate":"rust/all/fmt","host":"linux-x86_64","key":"ebefaf2c6ec7ad1ced392d011a83af264e9fb058251f6171f0c368162a5fee71","lane":"lint","parents":["994d7f7c3226279dc0ac4fdcf98a30608605afe0"],"secs":55,"stamp":"4cb12aefde6751e86a5b86ab939ea0b8","tree":"99d8f537a30ffc1191f65f531a0c15db1060fe46","v":1,"via":"run"} Ci-Attestation: {"at":1792006022,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"ebefaf2c6ec7ad1ced392d011a83af264e9fb058251f6171f0c368162a5fee71","lane":"lint","parents":["994d7f7c3226279dc0ac4fdcf98a30608605afe0"],"secs":55,"stamp":"94e7a60f338c22f8f4609a4d2d8cc06f","tree":"99d8f537a30ffc1191f65f531a0c15db1060fe46","v":1,"via":"run"} Ci-Attestation: {"at":1792006022,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"02c494578a57a46596a4051ba975b7636cc97358dd36f1be69fea8296477c985","lane":"rust-test","parents":["994d7f7c3226279dc0ac4fdcf98a30608605afe0"],"secs":126,"stamp":"006a2b7b0d75e764d8cab9c4a9a27391","tree":"99d8f537a30ffc1191f65f531a0c15db1060fe46","v":1,"via":"run"} Ci-Attestation: {"at":1792006022,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"9355a386d7d47e047c4818ab8214fbb9916ced3333240d0e52c5707bc24b86e3","lane":"cross","parents":["994d7f7c3226279dc0ac4fdcf98a30608605afe0"],"secs":113,"stamp":"70fba730ce8f7f44852fefcbb73596f8","tree":"99d8f537a30ffc1191f65f531a0c15db1060fe46","v":1,"via":"run"} Ci-Attestation: {"at":1792006022,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"9355a386d7d47e047c4818ab8214fbb9916ced3333240d0e52c5707bc24b86e3","lane":"cross","parents":["994d7f7c3226279dc0ac4fdcf98a30608605afe0"],"secs":113,"stamp":"e1308356b3bd14b171eb0f0b5d3d1839","tree":"99d8f537a30ffc1191f65f531a0c15db1060fe46","v":1,"via":"run"} Ci-Attestation: {"at":1792006022,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"9355a386d7d47e047c4818ab8214fbb9916ced3333240d0e52c5707bc24b86e3","lane":"cross","parents":["994d7f7c3226279dc0ac4fdcf98a30608605afe0"],"secs":113,"stamp":"94dc94ab6d2ce712ecb52a336d65276d","tree":"99d8f537a30ffc1191f65f531a0c15db1060fe46","v":1,"via":"run"} Ci-Attestation: {"at":1792006022,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"9355a386d7d47e047c4818ab8214fbb9916ced3333240d0e52c5707bc24b86e3","lane":"cross","parents":["994d7f7c3226279dc0ac4fdcf98a30608605afe0"],"secs":113,"stamp":"39c892d4de0fff84352ed07a0e82cd67","tree":"99d8f537a30ffc1191f65f531a0c15db1060fe46","v":1,"via":"run"} Ci-Attestation: {"at":1792006022,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"9355a386d7d47e047c4818ab8214fbb9916ced3333240d0e52c5707bc24b86e3","lane":"cross","parents":["994d7f7c3226279dc0ac4fdcf98a30608605afe0"],"secs":113,"stamp":"02872ff13889d75691d286d4b3f66a17","tree":"99d8f537a30ffc1191f65f531a0c15db1060fe46","v":1,"via":"run"} Ci-Attestation: {"at":1792006022,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"9355a386d7d47e047c4818ab8214fbb9916ced3333240d0e52c5707bc24b86e3","lane":"cross","parents":["994d7f7c3226279dc0ac4fdcf98a30608605afe0"],"secs":113,"stamp":"5fbba209d79e25c63614b371c6adcb5c","tree":"99d8f537a30ffc1191f65f531a0c15db1060fe46","v":1,"via":"run"} Ci-Attestation: {"at":1792006022,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"3454e4780d4b8feaa0f764f033bd7139d67e7391b94934be0f08e9721e45e57e","lane":"tier2-linux","parents":["994d7f7c3226279dc0ac4fdcf98a30608605afe0"],"secs":218,"stamp":"21c187f9d1df2453e9e227cca653c71f","tree":"99d8f537a30ffc1191f65f531a0c15db1060fe46","v":1,"via":"run"}
Member
|
Rebased onto master, set
|
zackees
force-pushed
the
port/audio-io-windows
branch
from
October 14, 2026 19:27
4635a18 to
d41539c
Compare
10 of 22 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Windows half of
libobs/media-io/audio-io.c. The Unix engine was already on master and stayed off on Windows because the worker lock was a pthread mutex and the C file registers an MMCSS Audio task. This port builds that engine on Windows: a recursiveCRITICAL_SECTION, andAvSetMmThreadCharacteristicsW(L"Audio")for the worker's lifetime.ENABLE_RUST_LIBOBSnow dropsmedia-io/audio-io.con Windows too.Refs #728
The resampler and FFmpeg wrapper stay C. Header inlines stay C.
This PR also deletes
docs/lessons.md. This repo does not keep that file.Intentional differences (also in
rust/README.mdand theaudio_outputheader):os_event_try.CRITICAL_SECTIONand registers the MMCSS "Audio" task.RED then GREEN
5ce9437b7test: fail Windows audio-io open against a stub lock.open_getters_stereoexpectsaudio_output_opento return 0 and getsAUDIO_OUTPUT_FAIL(-2), becauseRecursiveMutex::initreturned an error.52d54988dobs-media-io: build audio-io.c on Windows.3568573earustfmt of the Windows link list.docs/lessons.mdis removed at HEAD.Tests
Mutation:
RecursiveMutex::initreturned an error after a successfulInitializeCriticalSectionAndSpinCount.getters_matchpanicked withrust open: -2. That break was reverted.Local, on this machine:
soldr cargo test --workspace --locked(local-gaterust-test): passed. Audio bins onx86_64-pc-windows-msvc:audio_io6,audio_io_core6,audio_io_parity14, plus the existing inline and layout bins.audio_input_init: Failed to create resampleris the expected blog line from the resample-failure cases.x86_64-pc-windows-gnu(--no-run). It does not execute those binaries.soldr cargo fmt --all --checkpassed after3568573ea.soldr cargo clippy --workspace --all-targets --locked -- -D warningspassed.rust/included) and gersemi (357 files) passed inside the lint lane.--workspace --exclude obs-c-oracle --lib --bins -D warnings) andcargo check --workspace --testspassed forx86_64-pc-windows-msvc. The same commands foraarch64-apple-darwinstopped while unpacking the Apple SDK: symlink copies failed with error 1314, thenThe filename or extension is too long. (os error 206).x86_64-apple-darwinwas not started. Dylint steps of that lane were not run (see below).Not run here, so this PR does not claim them and is not stamped:
ci/test_*.py(self_test) fails in this environment before fmt/clippy/dylint: CRLFgit check-ignoreoutput, the dirtyplugins/obs-websocketsubmodule, and missing tools. Those failures are not from this port. The submodule was left as it was.soldr cargo dylintdoes not finish on this host. It printscargo diagnostic capture still runningand spawns a storm of short-livedrustup.exe. Copying the downloaded driver todylint-driver.exedid not change that. GitHub CI should run Dylint.tier2-linux(cmocka OFF/ON and the symbol diff) did not run.rust/tools/tier2-validate/validate.ps1did not run.The
claimedlabel on #728 still needs a maintainer. Do not tick the tracking checkboxes until this merges.Test plan
rust-testandrust-cross-lint(includes Dylint)ENABLE_RUST_LIBOBSOFF and ON, includingtest_audio_iomedia-io/audio-io.cwhen Rust is on and still linksaudio_output_*