mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
fix(app): only warn about software encoding when no layer is accelerated (#1815)
This commit is contained in:
1 parent
10bc8c1efa
commit
ffaf5119d8
1 file changed
+10
-10
@@ -414,10 +414,6 @@ export type ScreenShareEncoderVerificationFailure =
|
|||||||
| (StalledVideoEncoderInfo & {reason: 'stalled'})
|
| (StalledVideoEncoderInfo & {reason: 'stalled'})
|
||||||
| MissingExpectedVideoEncoderInfo;
|
| MissingExpectedVideoEncoderInfo;
|
||||||
|
|
||||||
function isSoftwareEncoderStats(implementation: string | null, powerEfficientEncoder: boolean | null): boolean {
|
|
||||||
return classifyVideoEncoderAcceleration(implementation, powerEfficientEncoder) === 'software';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getStatsKind(report: OutboundVideoStatsEntry, codecs: Map<string, CodecStatsEntry>): string | undefined {
|
function getStatsKind(report: OutboundVideoStatsEntry, codecs: Map<string, CodecStatsEntry>): string | undefined {
|
||||||
if (report.kind || report.mediaType) return report.kind ?? report.mediaType;
|
if (report.kind || report.mediaType) return report.kind ?? report.mediaType;
|
||||||
if (!report.codecId) return undefined;
|
if (!report.codecId) return undefined;
|
||||||
@@ -462,6 +458,7 @@ export function findSoftwareVideoEncoder(stats: RTCStatsReport, codec?: VideoCod
|
|||||||
reports.push(report);
|
reports.push(report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let softwareEncoder: SoftwareVideoEncoderInfo | null = null;
|
||||||
for (const report of reports) {
|
for (const report of reports) {
|
||||||
if (getStatsKind(report, codecs) !== 'video') continue;
|
if (getStatsKind(report, codecs) !== 'video') continue;
|
||||||
if (report.codecId && !codecMatchesTarget(codecs.get(report.codecId)?.mimeType, codec)) continue;
|
if (report.codecId && !codecMatchesTarget(codecs.get(report.codecId)?.mimeType, codec)) continue;
|
||||||
@@ -471,13 +468,16 @@ export function findSoftwareVideoEncoder(stats: RTCStatsReport, codec?: VideoCod
|
|||||||
: null;
|
: null;
|
||||||
const powerEfficientEncoder =
|
const powerEfficientEncoder =
|
||||||
typeof report.powerEfficientEncoder === 'boolean' ? report.powerEfficientEncoder : null;
|
typeof report.powerEfficientEncoder === 'boolean' ? report.powerEfficientEncoder : null;
|
||||||
if (!isSoftwareEncoderStats(implementation, powerEfficientEncoder)) continue;
|
const acceleration = classifyVideoEncoderAcceleration(implementation, powerEfficientEncoder);
|
||||||
return {
|
if (acceleration === 'hardware') return null;
|
||||||
implementation: implementation ?? UNKNOWN_ENCODER_IMPLEMENTATION,
|
if (acceleration === 'software' && softwareEncoder === null) {
|
||||||
powerEfficientEncoder,
|
softwareEncoder = {
|
||||||
};
|
implementation: implementation ?? UNKNOWN_ENCODER_IMPLEMENTATION,
|
||||||
|
powerEfficientEncoder,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return softwareEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function shouldTriggerSoftwareEncoderWarning(codec: VideoCodec): boolean {
|
export function shouldTriggerSoftwareEncoderWarning(codec: VideoCodec): boolean {
|
||||||
|
|||||||
Reference in new issue
Block a user