Skip to content

Conversation

@sojeong-hwang
Copy link

This PR will...

This PR will make frameRate check configurable during ABR up/down transitions.

Why is this Pull Request needed?

Currently, the frameRate-based level switching is hardcoded and cannot be disabled.
This PR allows developers to control it via config for more flexible ABR tuning.

Are there any points in the code the reviewer needs to double check?

No special points.

Resolves issues:

N/A

@krseager
Copy link
Contributor

Is there a reason we wouldn't want to just have a config value that sets a framerate cap? i.e. 60fps / 30fps?

Comment on lines -901 to +913
(upSwitch && currentFrameRate > levelInfo.frameRate) ||
(upSwitch &&
currentFrameRate > levelInfo.frameRate &&
!isUpSwitchToLowerFrameRate) ||
(!upSwitch &&
currentFrameRate > 0 &&
currentFrameRate < levelInfo.frameRate) ||
currentFrameRate < levelInfo.frameRate &&
!isDownSwitchToHigherFrameRate) ||
Copy link
Collaborator

@robwalch robwalch Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think unblocking selection behavior via config is a good solution to working around content that does not follow best practices when providing frame rates at various bitrates (an example with 360-720p@30, 1080p@60, and 4k@29.997 was given offline).

First, we could loosen the checks to allow switching between almost identical frame rates. That could allow switching straight to a higher bitrate at 29.997 from 30 fps. There would still be a chance to switch up to 60fps and then not switch up any higher. The user should be presented with the resolution and frame-rates to allow manual override in these cases. Allowing the client to automatically bounce back and forth between rates should be avoided.

Adding a frameRate (preferred) and maxFrameRate options to the videoPreference: VideoSelectionOption config options interface for initial selection and capping would be preferred. You might also consider making capping part of the fps-controller, (see capLevelOnFPSDrop) but that would entail more of a refactor as that controller is meant to limit selection based on performance, not the variant frame-rate. It could do both, or either, if a simple flat capLevelByFrameRate option is preferred.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested-Workaround: If you really want to force hls.js to ignore level frameRate than change the parsed values after playback has started on hls.levels to all be the same. It may seem like a hack, but it's a valid workaround after level.supportedPromise is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants