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: retry appends on QUOTA_EXCEEDED_ERR #1093

Merged
merged 4 commits into from
Mar 12, 2021
Merged

Conversation

gesinger
Copy link
Contributor

Requirements Checklist

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

@gesinger gesinger changed the title Fix/quota exceeded error fix: retry appends on QUOTA_EXCEEDED_ERR Mar 11, 2021
return;
}

this.error(`${type} append of ${bytes.length}b failed for segment ` +
Copy link
Member

Choose a reason for hiding this comment

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

should we log the error itself too? Maybe the message or callstack in it could have more info for us?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, probably a good idea to add that in.

Comment on lines +2082 to +2087
const audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0;
const audioBufferEnd = audioBuffered.length ?
audioBuffered.end(audioBuffered.length - 1) : 0;
const videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0;
const videoBufferEnd = videoBuffered.length ?
videoBuffered.end(videoBuffered.length - 1) : 0;
Copy link
Member

Choose a reason for hiding this comment

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

any issues with just clearing from 0 to now-MIN_BACK_BUFFER??

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see. This is to see if the segment is too large and removing the back buffer won't help.

Comment on lines +2138 to +2139
// wait the length of time alotted in the back buffer to prevent wasted
// attempts (since we can't clear less than the minimum)
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we be waiting based on the forward buffer? Though, waiting 1s each time makes sense. Just not sure it makes say to make it based on back buffer.

Copy link
Member

Choose a reason for hiding this comment

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

Also, can't we wait for updateend to know that stuff have been removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The forward buffer may be changing in the case of demuxed content.

And updateend won't always fire for the removes (particularly if the buffer doesn't exist).

Comment on lines +1328 to +1332
const quotaExceededError = new Error();

quotaExceededError.code = QUOTA_EXCEEDED_ERR;

throw quotaExceededError;
Copy link
Member

Choose a reason for hiding this comment

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

not that we should change this, but the alternative would've been throw {code: QUOTA_EXCEEDED_ERR};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The vjsstandard linter yelled at me for doing that at first (which I was surprised by, but changing to an actual error helped).

@gkatsev
Copy link
Member

gkatsev commented Mar 11, 2021

This PR makes Boat 4K play, fully, in Chrome without any errors in the console. In firefox, it now fails with Playback cannot continue. No available working or supported playlists..

@gkatsev
Copy link
Member

gkatsev commented Mar 11, 2021

Overall, definitely an improvement. We definitely should revisit this to try doing one or both of these:

  • downswitch if we continue encountering this error
  • break up large segments to make smaller appends. This potentially needs us to do a binary split appends or something to find optimal size. Like, first try and split segments in half, if we still got the error, split in fourths, then eights, etc until single GOP. Though, at some point downswitching (if we have a lower rendition) would definitely be better. This may be something that we try harder if say a user has chosen a particular playlist.

`Appended byte length: ${bytes.byteLength}, ` +
`audio buffer: ${timeRangesToArray(audioBuffered).join(', ')}, ` +
`video buffer: ${timeRangesToArray(videoBuffered).join(', ')}, `);
this.error({
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should try splitting the single append into two appends and halving the segment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I added that as a comment above. I think it would be good to try as a TODO, but I'm hesitant to do it just yet as I'm not sure how different browsers will behave if we append bytes that aren't split up on proper box boundaries.

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.

3 participants