From 5331c0216a93d3123e6bf44ead1caa1004fc182f Mon Sep 17 00:00:00 2001 From: Hampus Date: Thu, 20 Aug 2026 17:40:53 +0200 Subject: [PATCH] fix(voice): keep a remote track pinned at zero volume across re-attach (#1780) --- fluxer_app/pkgs/livekit-client/VENDORING.md | 9 +++++++++ .../livekit-client/src/room/track/RemoteAudioTrack.ts | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/fluxer_app/pkgs/livekit-client/VENDORING.md b/fluxer_app/pkgs/livekit-client/VENDORING.md index eb4103ad6..04b0ae433 100644 --- a/fluxer_app/pkgs/livekit-client/VENDORING.md +++ b/fluxer_app/pkgs/livekit-client/VENDORING.md @@ -52,6 +52,15 @@ source edits in this package. Forces Opus RED/FEC, stereo signaling, 10 ms packet time, no DTX, and a 510 kbps maximum average bitrate in local offers and remote answers. +10. **Remote audio volume restore at exactly zero** (`src/room/track/RemoteAudioTrack.ts`) + `attach()`, `connectWebAudio()` and `getVolume()` guarded the remembered + `elementVolume` with a truthiness check, so a track deliberately held at `0` + came back at full volume whenever it was re-attached or its Web Audio graph + was rebuilt. All three guards now test `!== undefined`. Note that remote + gains above `1.0` are only legal because `setVolume()` takes the Web Audio + `gainNode` branch; the `el.volume` branch would throw `IndexSizeError`. + `webAudioMix` must stay unconditional. + ## Updating from upstream 1. Check the upstream changelog for the target version. diff --git a/fluxer_app/pkgs/livekit-client/src/room/track/RemoteAudioTrack.ts b/fluxer_app/pkgs/livekit-client/src/room/track/RemoteAudioTrack.ts index ca79c15e6..bf391d537 100644 --- a/fluxer_app/pkgs/livekit-client/src/room/track/RemoteAudioTrack.ts +++ b/fluxer_app/pkgs/livekit-client/src/room/track/RemoteAudioTrack.ts @@ -64,7 +64,7 @@ export default class RemoteAudioTrack extends RemoteTrack { } getVolume(): number { - if (this.elementVolume) { + if (this.elementVolume !== undefined) { return this.elementVolume; } if (isReactNative()) { @@ -113,7 +113,7 @@ export default class RemoteAudioTrack extends RemoteTrack { element.muted = true; } - if (this.elementVolume) { + if (this.elementVolume !== undefined) { this.setVolume(this.elementVolume); } @@ -169,7 +169,7 @@ export default class RemoteAudioTrack extends RemoteTrack { lastNode.connect(this.gainNode); this.gainNode.connect(context.destination); - if (this.elementVolume) { + if (this.elementVolume !== undefined) { this.gainNode.gain.setTargetAtTime(this.elementVolume, 0, 0.1); }