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

fix: resume loading on segment timeout for experimentalBufferBasedABR #1333

Merged
merged 2 commits into from Nov 18, 2022

Conversation

gesinger
Copy link
Contributor

Previously, if there was a segment timeout and experimentalBufferBasedABR was set to true, then the main segment loader would stay in a READY state and never resume loading segments. This is because the buffer based ABR path doesn't follow the same flow as non buffer based ABR, where a new playlist would be loaded immediately and it would trigger a load. Buffer based ABR may determine that no rendition change should be made, despite the timeout, leading to nothing happening. This change makes the call to load explicit, but only for buffer based ABR on timeouts.

This addresses #1287

Test Changes

Changed

  • Updated test to show that experimentalBufferBasedABR does make a playlist selection on bandwidthupdate
  • Updated test to remove warning logged on a bandwidthupdate when there's only one playlist. This warning doesn't always make sense, as a timeout that causes a bandwidthupdate would be a connection issue, rather than a stream issue.

Added

  • Added test that segment-loader fires timeout event on timeout
  • Added test that master-playlist-controller reloads segment loader on timeout if experimentalBufferBasedABR

Testing

  1. Open the demo page. Enable [EXPERIMENTAL] Use Buffer Level for ABR (reloads player) and set preload to none.
  2. In Chrome Devtools use a very slow connection (I manually created a 10kbps profile).
  3. Press play
  4. Without the change, after the segment request times out (16.5 seconds for the first bipbop stream, no more requests are made and the buffering spinner remains. The video never starts, even if changing the network connectivity back to something reasonable.
  5. With the change, a new segment is requested and playback resumes (if changing network connectivity to something reasonable).

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
  • Reviewed by Two Core Contributors

Previously, if there was a segment timeout and
`experimentalBufferBasedABR` was set to `true`, then the main segment
loader would stay in a `READY` state and never resume loading segments.
This is because the buffer based ABR path doesn't follow the same flow
as non buffer based ABR, where a new playlist would be loaded
immediately and it would trigger a load. Buffer based ABR may determine
that no rendition change should be made, despite the timeout, leading
to nothing happening. This change makes the call to load explicit, but
only for buffer based ABR on timeouts.
});
this.mainSegmentLoader_.on('timeout', () => {
if (this.experimentalBufferBasedABR) {
// If a rendition change is needed, then it would've be done on `bandwidthupdate`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"would've been done"

@codecov
Copy link

codecov bot commented Oct 13, 2022

Codecov Report

Merging #1333 (555cc4a) into main (66707b4) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1333      +/-   ##
==========================================
+ Coverage   86.33%   86.34%   +0.01%     
==========================================
  Files          39       39              
  Lines        9857     9859       +2     
  Branches     2298     2299       +1     
==========================================
+ Hits         8510     8513       +3     
+ Misses       1347     1346       -1     
Impacted Files Coverage Δ
src/master-playlist-controller.js 94.79% <100.00%> (+0.13%) ⬆️
src/segment-loader.js 96.37% <100.00%> (+<0.01%) ⬆️

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

Copy link
Contributor

@evanfarina evanfarina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great

Copy link
Member

@misteroneill misteroneill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on collaborators call, we should ship this since it makes things better.

@misteroneill misteroneill merged commit 5666562 into videojs:main Nov 18, 2022
misteroneill pushed a commit that referenced this pull request Nov 21, 2022
Previously, if there was a segment timeout and
`experimentalBufferBasedABR` was set to `true`, then the main segment
loader would stay in a `READY` state and never resume loading segments.
This is because the buffer based ABR path doesn't follow the same flow
as non buffer based ABR, where a new playlist would be loaded
immediately and it would trigger a load. Buffer based ABR may determine
that no rendition change should be made, despite the timeout, leading
to nothing happening. This change makes the call to load explicit, but
only for buffer based ABR on timeouts.
misteroneill pushed a commit that referenced this pull request Nov 21, 2022
Previously, if there was a segment timeout and
`experimentalBufferBasedABR` was set to `true`, then the main segment
loader would stay in a `READY` state and never resume loading segments.
This is because the buffer based ABR path doesn't follow the same flow
as non buffer based ABR, where a new playlist would be loaded
immediately and it would trigger a load. Buffer based ABR may determine
that no rendition change should be made, despite the timeout, leading
to nothing happening. This change makes the call to load explicit, but
only for buffer based ABR on timeouts.
misteroneill pushed a commit that referenced this pull request Nov 21, 2022
Previously, if there was a segment timeout and
`experimentalBufferBasedABR` was set to `true`, then the main segment
loader would stay in a `READY` state and never resume loading segments.
This is because the buffer based ABR path doesn't follow the same flow
as non buffer based ABR, where a new playlist would be loaded
immediately and it would trigger a load. Buffer based ABR may determine
that no rendition change should be made, despite the timeout, leading
to nothing happening. This change makes the call to load explicit, but
only for buffer based ABR on timeouts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants