From ffaf5119d83b4de81a44874f646e5839b6e4c0a4 Mon Sep 17 00:00:00 2001 From: Hampus Date: Fri, 21 Aug 2026 18:49:51 +0200 Subject: [PATCH] fix(app): only warn about software encoding when no layer is accelerated (#1815) --- .../voice_screen_share_manager/shared.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fluxer_app/src/features/voice/engine/voice_screen_share_manager/shared.ts b/fluxer_app/src/features/voice/engine/voice_screen_share_manager/shared.ts index 589eacd09..bad751b08 100644 --- a/fluxer_app/src/features/voice/engine/voice_screen_share_manager/shared.ts +++ b/fluxer_app/src/features/voice/engine/voice_screen_share_manager/shared.ts @@ -414,10 +414,6 @@ export type ScreenShareEncoderVerificationFailure = | (StalledVideoEncoderInfo & {reason: 'stalled'}) | MissingExpectedVideoEncoderInfo; -function isSoftwareEncoderStats(implementation: string | null, powerEfficientEncoder: boolean | null): boolean { - return classifyVideoEncoderAcceleration(implementation, powerEfficientEncoder) === 'software'; -} - function getStatsKind(report: OutboundVideoStatsEntry, codecs: Map): string | undefined { if (report.kind || report.mediaType) return report.kind ?? report.mediaType; if (!report.codecId) return undefined; @@ -462,6 +458,7 @@ export function findSoftwareVideoEncoder(stats: RTCStatsReport, codec?: VideoCod reports.push(report); } } + let softwareEncoder: SoftwareVideoEncoderInfo | null = null; for (const report of reports) { if (getStatsKind(report, codecs) !== 'video') continue; if (report.codecId && !codecMatchesTarget(codecs.get(report.codecId)?.mimeType, codec)) continue; @@ -471,13 +468,16 @@ export function findSoftwareVideoEncoder(stats: RTCStatsReport, codec?: VideoCod : null; const powerEfficientEncoder = typeof report.powerEfficientEncoder === 'boolean' ? report.powerEfficientEncoder : null; - if (!isSoftwareEncoderStats(implementation, powerEfficientEncoder)) continue; - return { - implementation: implementation ?? UNKNOWN_ENCODER_IMPLEMENTATION, - powerEfficientEncoder, - }; + const acceleration = classifyVideoEncoderAcceleration(implementation, powerEfficientEncoder); + if (acceleration === 'hardware') return null; + if (acceleration === 'software' && softwareEncoder === null) { + softwareEncoder = { + implementation: implementation ?? UNKNOWN_ENCODER_IMPLEMENTATION, + powerEfficientEncoder, + }; + } } - return null; + return softwareEncoder; } export function shouldTriggerSoftwareEncoderWarning(codec: VideoCodec): boolean {