Skip to content
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

Buffer hole on level switch #5631

Open
5 tasks done
tvinko opened this issue Jul 6, 2023 · 11 comments
Open
5 tasks done

Buffer hole on level switch #5631

tvinko opened this issue Jul 6, 2023 · 11 comments
Labels
Milestone

Comments

@tvinko
Copy link

tvinko commented Jul 6, 2023

What version of Hls.js are you using?

1.4.7

What browser (including version) are you using?

Chrome v114.0.5735.198 (Official Build) (arm64)

What OS (including version) are you using?

MacOS

Test stream

https://hlsjs.video-dev.org/demo/?src=https%3A%2F%2Fvz-ced6ec5f-c54.b-cdn.net%2F55d2cc15-6524-48f7-aa7f-677d41d17eb2%2Fplaylist.m3u8&demoConfig=eyJlbmFibGVTdHJlYW1pbmciOnRydWUsImF1dG9SZWNvdmVyRXJyb3IiOnRydWUsInN0b3BPblN0YWxsIjpmYWxzZSwiZHVtcGZNUDQiOmZhbHNlLCJsZXZlbENhcHBpbmciOi0xLCJsaW1pdE1ldHJpY3MiOi0xfQ==

Configuration

{
  "debug": true,
  "enableWorker": true,
  "lowLatencyMode": true,
  "backBufferLength": 90,
  "maxStarvationDelay": 4
}

Additional player setup steps

No response

Checklist

Steps to reproduce

  1. Play the stream
  2. Video freezes for few seconds when level is switched

Expected behaviour

Video doesn't switch on resolution change

What actually happened?

Problem occured only on Chrome. Safari and Firefox are not experiencing this issue.

There is a buffer hole for some reason that starts on 3.921333 second of the video and ends on 3.988
Buffer state:
Duration: 9.215999
Buffered: [0.021333, 3.921333] [3.988, 9.215999]
Seekable: [0, 9.215999]
Played: [0, 9.215999]
Buffer for audio contains:[0, 9.215999]
Buffer for video contains:[0.021333, 3.921333] [3.988, 9.187999]
Dropped frames: 0
Corrupted frames: 0
TTFB Estimate: 5.000
Bandwidth Estimate: 32859297.994

Console output

7.655 | Buffer stalled error

Chrome media internals output

No response

@tvinko tvinko added Bug Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Jul 6, 2023
@M-Joyce
Copy link

M-Joyce commented Sep 7, 2023

@M-Joyce
Copy link

M-Joyce commented Sep 8, 2023

Actually, looks to be resolved or atleast minimized in the hlsjs-dev demo. EDIT: Nevermind, upon testing on desktop the issue still persists in hls-dev

@robwalch
Copy link
Collaborator

robwalch commented Sep 8, 2023

I tried with #5806. It addresses the gap in @M-Joyce's sample, but for your example @tvinko, the decode timestamps align perfectly, however the subsequent append still produces a gap.

Current workaround right now is setting a startLevel at 2 for me in the config, but that isn't ideal for slower connections.

That's an excellent work-around.

@robwalch robwalch added Suggested-Workaround browser: Chrome and removed Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Sep 8, 2023
@robwalch
Copy link
Collaborator

robwalch commented Sep 8, 2023

Can you each confirm whether or not the gap is only present in Chrome? If that's the case we might want to add come comments with additional reproduction steps to https://bugs.chromium.org/p/chromium/issues/detail?id=1478681

@robwalch
Copy link
Collaborator

robwalch commented Sep 8, 2023

Since this is fairly common in Chrome and the stall behavior in Chrome is bad when crossing gaps, I may consider adding logic to preempt the stall after crossing video TimeRanges with a nudge-seek.

@M-Joyce
Copy link

M-Joyce commented Sep 8, 2023

Can you each confirm whether or not the gap is only present in Chrome? If that's the case we might want to add come comments with additional reproduction steps to https://bugs.chromium.org/p/chromium/issues/detail?id=1478681

Just did some testing.

Edge: Still freezes
Chrome: Still freezes
Chrome android: still freezes
Samsung Internet Browser (galaxy s22+): Still freezes
Edge with Internet Explorer mode on: Does not freeze

As for #5806, is this something I can pull down locally and test myself? Is it part of the dev hls releases? The issue still happens in chrome on hlsjs-dev.

@robwalch
Copy link
Collaborator

robwalch commented Sep 8, 2023

As for #5806, is this something I can pull down locally and test myself? Is it part of the dev hls releases? The issue still happens in chrome on hlsjs-dev.

See the Cloudflare Pages build check Details link
https://github.com/video-dev/hls.js/pull/5806/checks?check_run_id=16603150891 >
https://bugfix-chrome-avc-gaps-m2ts.hls-js-4zn.pages.dev/

@M-Joyce
Copy link

M-Joyce commented Sep 8, 2023

Tested my issue on https://bugfix-chrome-avc-gaps-m2ts.hls-js-4zn.pages.dev/ and it resolves the freeze. Video continues playing normally, with no or unnoticeable buffer.

robwalch added a commit that referenced this issue Sep 8, 2023
@robwalch robwalch added this to the 1.6.0 milestone Sep 12, 2023
@robwalch
Copy link
Collaborator

Since this is fairly common in Chrome and the stall behavior in Chrome is bad when crossing gaps, I may consider adding logic to preempt the stall after crossing video TimeRanges with a nudge-seek.

@tvinko, I'll revisit more proactive nudging over video buffer gaps in v1.6. I've done what I could to repair remuxed mp4 fragments before append (#5805, #5806) and prevent overlapping segment selection on switch (#5804) for this next release.

Since the symptom involves no rendering of video past the gap / new TimeRange, followed by a stall, we should also look at how dropped frames are measured and consider a combined solution with late append reporting in master...feature/video-buffer-starved

@robwalch robwalch added the Revisit-at-later-release-cycle Will revisit during release cycle indicated by the Milestone label Sep 14, 2023
@robwalch
Copy link
Collaborator

Related issue and novel workaround w3c/media-source#160 (comment)

@wolenetz
Copy link

wolenetz commented Nov 9, 2023

Related issue and novel workaround w3c/media-source#160 (comment)

I like "novel workaround" instead of the name I had been using :)
Regardless, I've recalled further complications (mostly around audio buffered gaps) that might impair effective use of that workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants