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: bad timeline changes #1526

Closed adrums86 closed 4 months ago

adrums86 commented 4 months ago

Description

Sometimes when we're switching timelines, we run into a situation where the buffer is starved due to the main or audio trying to switch to separate timelines. shouldWaitForTimelineChange is called when deciding whether to wait to load or append the current segment. The conditions for this to return false are:

CleanShot 2024-07-15 at 11 23 01

This causes the loader to get stuck waiting for the other loader to sync up for a timelineChange which never happens and eventually stalls playback.

Specific Changes proposed

Add checks in the loader to look for bad timeline changes, instances such as this where the loaders are both pending timeline changes to separate timelines and resetting the loader when those cases occur, in order to re-sync timelines and avoid a stall.

Requirements Checklist

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 86.33%. Comparing base (28cb9fd) to head (48551a6).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1526 +/- ## ========================================== + Coverage 86.31% 86.33% +0.02% ========================================== Files 43 43 Lines 11097 11119 +22 Branches 2532 2540 +8 ========================================== + Hits 9578 9600 +22 Misses 1519 1519 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

dzianis-dashkevich commented 4 months ago

Good finding!