Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(voice): keep a remote track pinned at zero volume across re-attach (#1780)

Hampus5331c0216a93
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<Track.Kind.Audio> {
}
getVolume(): number {
- if (this.elementVolume) {
+ if (this.elementVolume !== undefined) {
return this.elementVolume;
}
if (isReactNative()) {
@@ -113,7 +113,7 @@ export default class RemoteAudioTrack extends RemoteTrack<Track.Kind.Audio> {
element.muted = true;
}
- if (this.elementVolume) {
+ if (this.elementVolume !== undefined) {
this.setVolume(this.elementVolume);
}
@@ -169,7 +169,7 @@ export default class RemoteAudioTrack extends RemoteTrack<Track.Kind.Audio> {
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);
}