mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-02 12:08:37 +01:00
fix(casting): apply conservative bitrate cap on downgrade retry
The status-2100 downgrade retry overrode only the device profile's MaxStreamingBitrate. Jellyfin uses the explicit getStreamUrl maxBitrate request param as the effective ceiling, so a quality-menu bitrate would survive the retry. Clamp options.maxBitrate to the fallback cap too. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -120,13 +120,27 @@ export const loadCastMedia = async (
|
||||
return { ok: false, error };
|
||||
}
|
||||
// Downgrade-on-failure: one retry with the safest possible profile.
|
||||
// The bitrate cap must also be applied to the explicit getStreamUrl
|
||||
// `maxBitrate` request param — Jellyfin uses that as the effective
|
||||
// ceiling, so the conservative profile alone would not lower it.
|
||||
try {
|
||||
const fallback = detectCapabilities(params.device, {
|
||||
profileMode: "force-h264",
|
||||
});
|
||||
await attemptLoad(params, {
|
||||
const FALLBACK_MAX_BITRATE = 4_000_000;
|
||||
const fallbackParams: CastLoadParams = {
|
||||
...params,
|
||||
options: {
|
||||
...params.options,
|
||||
maxBitrate: Math.min(
|
||||
params.options?.maxBitrate ?? Number.POSITIVE_INFINITY,
|
||||
FALLBACK_MAX_BITRATE,
|
||||
),
|
||||
},
|
||||
};
|
||||
await attemptLoad(fallbackParams, {
|
||||
...fallback,
|
||||
maxVideoBitrate: 4_000_000,
|
||||
maxVideoBitrate: FALLBACK_MAX_BITRATE,
|
||||
maxAudioChannels: 2,
|
||||
});
|
||||
return { ok: true };
|
||||
|
||||
Reference in New Issue
Block a user