From e73285060e14cd1e6b7fb99b241f77419b0feff9 Mon Sep 17 00:00:00 2001 From: Hampus Date: Wed, 2 Sep 2026 17:34:24 +0200 Subject: [PATCH] fix(voice): honour the codec preference in fallback selection (#2390) --- .../features/voice/engine/ScreenShareCodecNegotiation.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fluxer_app/src/features/voice/engine/ScreenShareCodecNegotiation.ts b/fluxer_app/src/features/voice/engine/ScreenShareCodecNegotiation.ts index 69fc48343..547d4d6d5 100644 --- a/fluxer_app/src/features/voice/engine/ScreenShareCodecNegotiation.ts +++ b/fluxer_app/src/features/voice/engine/ScreenShareCodecNegotiation.ts @@ -549,7 +549,11 @@ class ScreenShareCodecNegotiation { selector: (preference: CodecPreference) => VideoCodec, preference: CodecPreference, ): VideoCodec { - if (this.selectedCodec && this.canUseSelectedCodecForCurrentParticipants(this.selectedCodec)) { + if ( + preference === 'auto' && + this.selectedCodec && + this.canUseSelectedCodecForCurrentParticipants(this.selectedCodec) + ) { return this.selectedCodec; } if (this.localCodecs.length === 0) this.localCodecs = buildLocalCodecAdvertisements(); @@ -560,7 +564,8 @@ class ScreenShareCodecNegotiation { unknownParticipants, getScreenShareCodecPreferenceOrder(preference), ); - return negotiated.codec ?? selector('auto'); + if (getEncodeSet(this.localCodecs).has(negotiated.codec)) return negotiated.codec; + return selector(preference); } private getRemoteCodecInputs(room: Room | null = this.room): {