fix(room_io): respect outputOptions.audioPublishOptions when publishing audio track - #2076
Merged
Merged
Conversation
…ng audio track
ParticipantAudioOutput.publishTrack() ignored the configured
trackPublishOptions and always published with a hardcoded
TrackPublishOptions({ source: SOURCE_MICROPHONE }), so options like
dtx: false / red: false passed via outputOptions.audioPublishOptions
were silently dropped and the track always negotiated the FFI defaults
(dtx and red enabled).
Fixes livekit#1954
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 0179006 The changes in this PR will be included in the next version bump. This PR includes changesets to release 37 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
toubatbrian
approved these changes
Jul 20, 2026
Merged
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.
Description
Fixes #1954.
RoomIOacceptsoutputOptions.audioPublishOptionsand threads it intoParticipantAudioOutputasoptions.trackPublishOptions, butpublishTrack()never read it. It always published with a fresh hardcodednew TrackPublishOptions({ source: TrackSource.SOURCE_MICROPHONE }), so the configured option was silently dropped.Because the proto fields are optional, unset
dtx/redfall through to the Rust FFI defaults (dtx: true, red: true), which means agents could not disable Opus DTX or RED on their output track no matter what they passed. With DTX forced on, TTS audio containing silence padding produces audible gate/pop artifacts at sentence boundaries.Changes Made
ParticipantAudioOutput.publishTrack()now publishes withthis.options.trackPublishOptions, keeping the previous hardcoded options as a fallback. No behavior change for callers who don't passaudioPublishOptions:DEFAULT_ROOM_OUTPUT_OPTIONSalready suppliesnew TrackPublishOptions({ source: TrackSource.SOURCE_MICROPHONE })._output.test.tsassertingpublishTrack()uses the configured options (verified it fails against the previous implementation).@livekit/agentspatch).Pre-Review Checklist
Testing
pnpm build(tsup +tsc --declaration),eslint,prettier --check, andvitest run src/voice/room_io/_output.test.ts(6/6) all pass locally. The new test fails without the one-line fix and passes with it.Additional Notes
The issue includes a runtime repro: publishing with
dtx: false, red: falseviaoutputOptions.audioPublishOptionsand observing the publisher SDP still negotiatingusedtx=1. After this change the configured options reachlocalParticipant.publishTrack()directly.🤖 Generated with Claude Code