Repository navigation
Fix inverted AudioPublishOptions.red - #1272
Merged
Merged
Conversation
The default red: true was sent as disableRed: true, so RED was off for every audio publish since 2.0.0, and red: false turned it on. Negate the option like disableDtx and the other SDKs do. E2EE still forces RED off. The test publishes through the mocks and checks the AddTrackRequest, so the mock socket now records sent data and the mock peer connection hands out a stub transceiver.
hiroshihorie
marked this pull request as ready for review
October 30, 2026 23:23
hiroshihorie
requested review from
changt,
cloudwebrtc and
xianshijing-lk
as code owners
October 30, 2026 23:23
cloudwebrtc
approved these changes
Nov 2, 2026
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.
Fixes #1271
AudioPublishOptions.redwas passed toAddTrackRequest.disableRedwithout negation. The defaultred: truesentdisableRed: true, so RED has been off for every Flutter audio publish since 2.0.0, andred: falseturned it on.This matches the JS (
this.isE2EEEnabled || !(opts.red ?? true)) and Rust SDKs. E2EE still forces RED off.Why it matters
The SFU decides from
disableRedwhether to preferaudio/redin the publisher answer. Flutter sends no audio simulcast codecs, soIsRedEnabledfalls back to!disableRed. libwebrtc always offers RED after Opus, so with this fix RED gets negotiated on all platforms.History
The inverted line came in with #453 (2024-01-23), whose goal was to disable RED under E2EE for a Firefox decryption failure. That half was right. #720 later rewrote the line above it as
disableDtx: !publishOptions.dtxand left RED as is.Behavior change
Apps that set
red: falseto get RED working will now get RED disabled. The changeset says so.JS defaults RED off for stereo tracks. That does not apply here: Flutter never sends
stereoorTF_STEREO, so the server answer stripsstereo=1and Flutter always publishes mono Opus. The stereoAudioEncodingpresets only set a bitrate. JS also enables RED by default for mono.Tests
test/participant/audio_publish_red_test.dartpublishes a mic track through the room mocks and checks the sentAddTrackRequestfor the default,red: false, and E2EE cases. The first two fail on main. To let a publish run in a unit test,MockWebSocketConnectornow records sent data andMockPeerConnection.addTransceiverreturns a stub transceiver instead of throwing.Not yet checked against a real server.