feat(blocks): add builtin.audioenc, an audio encoder block - #744
Draft
wagenet wants to merge 1 commit into
Draft
Conversation
The Recorder only accepts pre-encoded audio, and the only audio encoders in the tree were buried inside the SRT and WHIP output blocks. A raw audio pad — a decoded WHIP input feeding a vision mixer, say — therefore could not be recorded at all. There was a videoenc block but no audio counterpart. This adds one, mirroring videoenc's structure: audioconvert -> audioresample -> capsfilter -> encoder -> parser -> capsfilter AAC (default), Opus, MP3 and AC-3, with bitrate, sample_rate and channels properties. Sample rate and channels both accept "source" to leave the upstream value untouched. Notes on the details: - The encoder is the first available candidate for the codec, skipping any factory whose rank is NONE so GST_PLUGIN_FEATURE_RANK=element:0 still works as the way to take an encoder out of play. - Bitrate is applied with set_property_from_str throughout, avoiding the enum-property panic class. lamemp3enc is special-cased: it takes kbps rather than bps, and only honours the value when target=bitrate. - Opus accepts only 8/12/16/24/48 kHz. An illegal rate is rejected at build time with a message naming the rate, rather than surfacing later as a not-negotiated error on a running flow. - AAC output caps deliberately leave stream-format unpinned, since aacparse converts between raw and adts and pinning either breaks the muxers wanting the other. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
wagenet
force-pushed
the
wagenet/audioenc-block
branch
from
September 2, 2026 16:41
eb64d05 to
fe6fedb
Compare
wagenet
marked this pull request as ready for review
September 2, 2026 16:45
wagenet
marked this pull request as draft
September 2, 2026 16:58
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.
What
Adds
builtin.audioenc, an audio encoder block, as the counterpart to the existingbuiltin.videoenc.The Recorder only accepts pre-encoded audio, and the only audio encoders in the tree were buried inside the SRT and WHIP output blocks. A raw audio pad — a decoded WHIP input feeding a vision mixer, say — therefore could not be recorded at all.
The block builds the chain:
Codecs: AAC (default), Opus, MP3, AC-3, with
bitrate,sample_rateandchannelsproperties.sample_rateandchannelsboth accept"source"to leave the upstream value untouched.Details worth review
GST_PLUGIN_FEATURE_RANK=element:0still works as the way to take an encoder out of play.set_property_from_strthroughout, avoiding the enum-property panic class.lamemp3encis special-cased: it takes kbps rather than bps, and only honours the value whentarget=bitrate.stream-formatunpinned, sinceaacparseconverts between raw and adts and pinning either breaks the muxers wanting the other.Testing
Which commands actually ran, and where:
cargo clippy --workspace --all-targets -- -D warnings— passed against this exact commit (fe6fedb), dev profile.--all-targetscovers the lib-test target, so the block and its test module both typecheck.cargo fmt --all -- --check— passed against this exact commit.audioencunit tests,openapi_test(1 passed) andpipeline_lifecycle_test(3 passed) were run in a separate checkout. That tree differed from this commit only in doc comments and oneneedless_borrowcleanup — no behavioural difference — so the results carry over, but they were not re-run againstfe6fedbitself.One caveat, stated plainly rather than left implicit:
test_build_produces_the_full_chainreturns early when no AAC encoder is present, and it was skipped on the macOS machine used for development for that reason. The guard is not green-washing in CI — the Linux jobs installgstreamer1.0-libav, soavenc_aacis available and the test really executes there.No end-to-end flow was run through the new block on real media. The evidence above is compile-level plus unit tests.
🤖 Generated with Claude Code