videojs / http-streaming

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

Fix repeated segments issue during bandwidth update #1477

Closed dzianis-dashkevich closed 8 months ago

dzianis-dashkevich commented 8 months ago

Description

We may encounter duplicate segment loading during bandwidth updates. Since we are re-calculating timestampOffset during each quality switch it results in presenting of duplicate segments.

Consider the following situation: image

This log is placed in the chooseNextRequest_. As you can see:

Specific Changes proposed

Make an assumption that some segment or segment's part is already buffered if the difference between segment.end and buffered.end is less or equal to 2 * TIME_FUDGE_FACTOR (which is 0.06) Fallback by selecting the next part or segment using buffered.end + difference padding.

Requirements Checklist

codecov[bot] commented 8 months ago

Codecov Report

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

Comparison is base (5b87f69) 86.06% compared to head (3d04436) 87.13%. Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1477 +/- ## ========================================== + Coverage 86.06% 87.13% +1.07% ========================================== Files 42 42 Lines 10748 11887 +1139 Branches 2474 2904 +430 ========================================== + Hits 9250 10358 +1108 - Misses 1498 1529 +31 ```

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