Cached Fragments increase BandwidthEstimate causing suboptimal quality selection
Open
Nobody has claimed this yet.
Browser issue
Missing Feature
- Dominant language
- TypeScript
- Stars
- 16.9k
- Forks
- 2.8k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 27
Description
What version of Hls.js are you using?
1.4.12
What browser (including version) are you using?
Chrome 117.0.5938.48
What OS (including version) are you using?
Windows 11
Test stream
No response
Configuration
default
Additional player setup steps
No response
Checklist
- The issue observed is not already reported by searching on Github under https://github.com/video-dev/hls.js/issues
- The issue occurs in the stable client (latest release) on https://hlsjs.video-dev.org/demo and not just on my page
- The issue occurs in the latest client (main branch) on https://hlsjs-dev.video-dev.org/demo and not just on my page
- The stream has correct Access-Control-Allow-Origin headers (CORS)
- There are no network errors such as 404s in the browser console when trying to play the stream
Steps to reproduce
- Open a page with a hls.js-video and have it load some fragments into the cache.
- Reload the page with a throttled connection and watch the bandwidthEstimate
- When cached fragments are used, the bandwidthEstimate shoots up and causes the quality level to go up, even though the connection is actually bad. This causes the video to stall, when loading big fragments with a bad connection
Expected behaviour
Disregard cached fragments in the calculation of the bandwidthEstimate
What actually happened?
Cached fragments are being treated as if they were loaded over the network
Console output
Will paste more tomorrow, but will just show the bandwidthEstimate increasing to over 6Mb/s even though the connection is set to 1Mb/s.
This is from my logs in the console:
BandwidthEstimate: 404816640
BandwidthEstimate: 6228293.959612044
Even Though the connection is set to 1Mb/s
Chrome media internals output
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue using the listed Chrome, Windows 11, hls.js 1.4.12 setup and a throttled connection, then trace how bandwidthEstimate is updated when cached fragments are used. Confirm that cached fragments are excluded from network bandwidth measurement and that quality selection no longer rises incorrectly or causes stalls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- audio-video-rtc, frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100