-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial selection and level filtering based on preferred codecs and MediaCapabilities #5704
Conversation
src/controller/level-controller.ts
Outdated
({ videoCodec, videoRange, width, height }) => | ||
!!videoCodec || !!(width && height) || !isVideoRange(videoRange) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may not be following this correctly, but is the !isVideoRange(videoReange)
portion of this filter correct? The comment says "remove invalid video-range levels", but this logic seems to do the opposite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
823472d
to
bde0ad2
Compare
529fa70
to
cbd916a
Compare
6d12749
to
cc59087
Compare
b5964c9
to
1610b01
Compare
…he first variant in the multivariant playlist
…s checks from light build
…ll throw with Level default of 0.
1610b01
to
6061fef
Compare
This PR will...
Make initial variant selection based on preferred codec rather than the first variant in the multivariant playlist
hls.firstAutoLevel
is used to evaluate first level based on available codecs, resolution, framerate, default or autoselect audio options, audio channels, video-range, and score, not exceeding 1080p*, 30fps*, SDR, or stereo when possible.* Resolution and frame-rate of first auto level may exceed 1080p/30fps when initial bandwidth estimate allows and
capLevelToPlayerSize
is not enabled.MediaCapabilities support
mediaCapabilities.decodingInfo
checks for UHD, HFR, and HDR variants, as well as multi-channel-audio renditionsMediaCapabilities checks will be added to another PR to prevent switching up to UHD and HFR variants on constrained devices.
API enhancements
hls.firstAutoLevel
getter, used internally to get the starting level index.hls.levels
are sorted on height, frame rate, preferred codec, and video-range to infer order by quality. Height-first sorting allows cap-level-lontroller to set a max quality index at the maximum allowed resolution.hls.allAudioTracks
andhls.allSubtitleTracks
.abrEwmaDefaultEstimateMax
was added. HLS.js will no longer start on the first variant (hls.firstLevel
), or any variant of a preferred codec, if its BANDWIDTH exceeds this value.Changes to Level parsing
Level.bitrate
uses variant BANDWIDTH (required peak bitrate) before falling back to optional AVERAGE-BANDWIDTH.Level.averageBitrate
returns parsed AVERAGE-BANDWIDTH. Falls back to runtime averageLevel.realBitrate
(which is only set whenconfig.abrMaxWithRealBitrate
is enabled) and finallyLevel.bitrate
(BANDWIDTH).Level.frameRate
returns parsed FRAME-RATE number or 0.Level.codecs
returns parsed CODECS or emptry string.Level.score
returns parsed SCORE number or 0.Performance Improvements
Error handling improvements
BUFFER_APPEND_ERROR
andBUFFER_ADD_CODEC_ERROR
errors.level|track.fragmentError
count on successful append.Why is this Pull Request needed?
HLS.js is expected to select more efficient codecs from the start of playback.
Are there any points in the code the reviewer needs to double check?
Switching from SDR to HDR, stereo to multi-channel audio, or from one codec family to another, requires a manual level change. Options to auto-select or prefer these configurations may be added in the future. Auto codec switching may be added after implementing MediaCapabilities
MediaCapabilitiesDecodingInfo.transition
if it proves to be well supported and implemented.Additional MediaCapabilities options, like blocking and filtering levels before start (MANIFEST_PARSED), or choosing which variants to run checks on and what to do with supported results that are not smooth or power efficient will be considered upon request. Currently, all checks are performed after startup, and do not prevent manual selection of variants (levels) and renditions (audio tracks).
Resolves issues:
Related issues (may not resolve but should improve)
Checklist