Skip to content

Chromecast player stalling when gap in live manifest #1720

Closed
@maxi297

Description

Have you read the FAQ and checked for duplicate open issues?: Yes

What version of Shaka Player are you using?: v2.4.4

Can you reproduce the issue with our latest release version?: Yes

Can you reproduce the issue with the latest code from master?: Yes

Are you using the demo app or your own custom app?: Both

If custom app, can you reproduce the issue using our demo app?: Yes

What browser and OS are you using?:
Chromecast (for example: V1, V2, Ultra)

What are the manifest and license server URIs?:
Our manifest contains SegmentTemplate with a gap like this:

             <SegmentTemplate timescale="10000000" media="S!dxIDVP7...8BFgZnDU9QUEUtV0lERVZJTkV4IOIBFQGv/QualityLevels($Bandwidth$)/Fragments(video=$Time$)" initialization="S!dxIDVP7...8BFgZnDU9QUEUtV0lERVZJTkV4IOIBFQGv/QualityLevels($Bandwidth$)/Fragments(video=Init)">
                <SegmentTimeline>
                    <S t="15440366781137770" d="30000000" r="12"/>
                    <S d="20000000"/>
                    <S t="15440367201137770" d="30000000"/>
                </SegmentTimeline>
            </SegmentTemplate>

Our stream is DRM protected which will make it hard to reproduce. We could provide the URIs in private and more information if needed.

What did you do?
We have played a live stream with gaps in the manifest on Chromecast. When the gap occurs, the player buffers for many seconds. We do not own the manifest and have to deal with those gaps.

What did you expect to happen?
There is a jump over the gap and continue.

What actually happened?
The player got stalled until it was outside of the availability window.

Do you have any idea why this happens?
1- In GapJumpingController.onPollGapJump_, We successfully jumped over the gap. We then exit GapJumpingController.onPollGapJump_
2- 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'
3- The player is stalled until it was outside of the availability window.
4- The player returns in the seek range and can play again until the next gap.

Workaround for now
We are not completely clear about why the Chromecast is stalling. We believe that this device is not fast enough to seek. We can see that this problem does not occur on web with a Chrome browser.

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;
};

EDIT: The gaps on the 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. As of now, we are trying to gather more data with a gapJumpingGracePeriodInSeconds = 3. We might revisit this value if we see any side effects.

Questions:
1- Have you already experienced this issue? If so, how did you dealt with?
2- Do you have any comment/solution for our workaround?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

status: archivedArchived and locked; will not be updatedtype: bugSomething isn't working correctly

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions