Repository navigation
cvc::gl::capture: SDL3 audio-capture source (audio-source family device member) - #534
Merged
Merged
Conversation
…io-source family) open_audio_capture()/list_audio_capture_devices() wrap an SDL3 recording device (microphone, line-in, or any OS/virtual capture endpoint) as a cvc::ariadne::stream::frame_source producing interleaved f32 PCM — the device member of the audio-source family, composing with the pure tone/gain/mix members exactly like any other frame_source. The audio analogue of camera_source: SDL lives in cvcGL (its peripheral seam), gated on CVC_ENABLE_SDL, graceful no-op without it. Pull model (NULL callback + SDL_GetAudioStreamData), own device-sample-timeline pts. Drops at source per the frame_source BACKPRESSURE contract: an SDL recording FIFO accumulates every captured sample, so when the backlog exceeds an ~80 ms latency ceiling fill() sheds the oldest samples down to the most-recent chunk and advances the pts over the dropped audio (keeps it ~wall-clock, stays monotonic) — the audio analogue of the camera handing back only its newest frame. Subsystem refcount balanced on every path; join-before-free teardown; resume failure fails the open loudly rather than returning a silent dead source. Device-gated test (enumeration always; live capture behind CVC_TEST_AUDIO), mirroring cvcgl_camera_source; the transport and the pure audio sources are covered hardware-free by stream_test.
…ream-audio-device # Conflicts: # src/cvcGL/CMakeLists.txt
transfix
enabled auto-merge
October 2, 2026 14:26
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.
Stacked on #532 (shares the new
capture/dir + glob). Retarget tomasteronce #532 lands.Phase-3 holy-grail step (a): the device member of the audio-source family (tone/gain/mix are #533).
open_audio_capture()/list_audio_capture_devices()wrap an SDL3 recording device (mic, line-in, any OS/virtual capture endpoint) as acvc::ariadne::stream::frame_sourceemitting interleaved f32 PCM — so it composes with the pure members and feeds a stream exactly like any other source. The audio analogue ofcamera_source: SDL stays in cvcGL (its peripheral seam), gated onCVC_ENABLE_SDL, graceful no-op without it.Design
SDL_GetAudioStreamData); own device-sample-timeline pts.frame_sourceBACKPRESSURE contract: an SDL recording FIFO accumulates every sample, so when the backlog passes an ~80 ms latency ceilingfill()sheds the oldest down to the most-recent chunk and advances the pts over the dropped audio (keeps it ~wall-clock + monotonic) — the audio analogue of the camera handing back only its newest frame.Testing: device-gated
cvcgl_audio_source(enumeration always; live capture behindCVC_TEST_AUDIO), mirroringcvcgl_camera_source. Builds clean with SDL on; passes with graceful SKIP on a headless builder (no audio server). The transport layer and the pure audio sources are covered hardware-free bystream_test.Folds an adversarial review: the back-pressure/unbounded-backlog defect (the one real finding) plus the resume-return and weak-monotonicity-assertion nits.