-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Have you read the FAQ and checked for duplicate open issues?
Yes
Is your feature request related to a problem? Please describe.
This feature request comes from the following bug report: #1720
Summary: We had manifest with large gap in a live manifest. The Shaka player stalled until it was outside of the availability window. The sequence of events causing the issue is the following:
- In GapJumpingController.onPollGapJump_, We successfully jumped over the gap. We then exit GapJumpingController.onPollGapJump_
- We return in GapJumpingController.onPollGapJump_ and enter in handleStall_. Conditions are met (we haven't understood what this implies entirely) so that the player prints 'Flushing media pipeline due to stall inside buffered range'
- The player is stalled until it was outside of the availability window.
- The player returns in the seek range and can play again until the next gap.
What we would expect:
We would like the player not to stall but to simply jump over the gap and resume playing.
Describe the solution you'd like
We have implemented a workaround and are eager to see what you think of it. Our workaround is to add a grace period after a jump before stalling. Basically, everytime we jump, we keep the timestamp of NOW and before stalling, we check if we have jumped recently over gap. Here is the interesting part:
// shaka.media.GapJumpingController.prototype.onPollGapJump_ ...
if (gapIndex == -1) {
if (this.gracePeriodIsPast_(currentTime)) {
this.handleStall_();
return;
} else {
shaka.log.info('Stalling within grace period');
return;
}
// ...
if (isGapSmall || jumpLargeGap) {
// ...
this.lastJumpPerformedTime_ = this.getNow_();
}
/**
* @param {number} currentTime
* @return {boolean} if the grace period is past
*/
shaka.media.GapJumpingController.prototype.gracePeriodIsPast_ =
function(currentTime) {
return this.lastJumpPerformedTime_ +
this.config_.gapJumpingGracePeriodInSeconds
<= this.getNow_();
};
/**
* @return {number} now
*/
shaka.media.GapJumpingController.prototype.getNow_ = function() {
return new Date().getTime() / 1000;
};
Important note: The gaps we had on our live streams occur only once every 22m30s. Therefore, we do not fear to have many gaps in a short period of time. This fix would not work in that case because we might jump over the first gap, might end up near another gap and our gapJumpingGracePeriodInSeconds would not allow the player to jump again.
Describe alternatives you've considered
This was our best attempt so far to fix the issue.