videojs / http-streaming

HLS, DASH, and future HTTP streaming protocols library for video.js
https://videojs-http-streaming.netlify.app/
Other
2.53k stars 425 forks source link

fix(llhls): watcher causes playback failure #1398

Closed adrums86 closed 1 year ago

adrums86 commented 1 year ago

Description

Low latency streams can get into a bad state on startup and fail if the seek position is adjusted with the playback watcher, specifically by fixesBadSeeks. There are checks in that function that determine if a seek position is outside the seekable window. This seekable range is a calculated interval duration from the playlist, where the end of the seekable window is the duration - HOLD-BACK. When the player first calculates the seekable range from the manifest, the interval duration returned is not precise. Sometimes this non-precise duration will be greater than the precise duration determined after the playlist is loaded. Since the player uses the first, non-precise duration calculation to determine the start position of a live asset, if the precise duration is updated to a lesser value before the player completes the seek to the start position this can cause the start position to fall outside of the "safe seek window". When combined with a manifest that utilizes #EXT-X-INDEPENDENT-SEGMENTS tags, this would cause the player to get stuck requesting the same partial segment in rapid succession, triggering playlist exclusion logic and eventual a fatal MEDIA_ERR_DECODE.

The PRs for #EXT-X-INDEPENDENT-SEGMENTS support are: https://github.com/videojs/m3u8-parser/pull/165 and https://github.com/videojs/http-streaming/pull/1399

Specific Changes proposed

Adding an exclusion for LLHLS to allow for seeking beyond the "safe" seek window.

Requirements Checklist

codecov[bot] commented 1 year ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (main@f9a392f). Click here to learn what that means. The diff coverage is 100.00%.

:exclamation: Current head 4abadab differs from pull request most recent head 6c7eeae. Consider uploading reports for the commit 6c7eeae to get more accurate results

@@           Coverage Diff           @@
##             main    #1398   +/-   ##
=======================================
  Coverage        ?   85.47%           
=======================================
  Files           ?       40           
  Lines           ?    10026           
  Branches        ?     2320           
=======================================
  Hits            ?     8570           
  Misses          ?     1456           
  Partials        ?        0           
Impacted Files Coverage Δ
src/playback-watcher.js 98.34% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more