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

Player hangs indefinitely on a multi-period mpd when skipping ahead and then behind. #655

Closed
salmoro opened this issue Jan 12, 2017 · 21 comments
Assignees
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@salmoro
Copy link

salmoro commented Jan 12, 2017

  • What version of Shaka Player are you using?
    2.0.2

    • 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?
    Custom

  • If custom app, can you reproduce the issue using our demo app?
    Believe so but the uniqueness of what triggers the issue needs automatic programmed navigation to reproduced consistently

  • What browser and OS are you using?
    Chrome with windows 7&10 + chromium on Archlinux

  • What did you do?
    Started playing at precisely the beginning of a period other than the first and then jumped back to a previous period.

  • What content did you load?
    Custom MPD edited from the original "https://storage.googleapis.com/shaka-demo-assets/tos-pto-webvtt/dash.mpd" mpd, referencing its periods numerous times adding up to 70 periods and a duration of 89 minutes.

    • If standard demo asset, which one?
      N/A

    • If custom asset, what manifest and license server URIs?
      http://elchonon.com/shakarewind/1.mpd

    • How did you interact with the content, if at all?
      After experiencing this with normal rewind we've created a programmed navigation rule to consistently reproduce.

  • What did you expect to happen?
    Play as normal.

  • What actually happened?
    Player hangs indefinitely
    See elaborate description bellow

On a multi-period mpd, when skipping ahead and then behind (to a previous period which hasn't been loaded yet) Shaka hangs indefinitely.

Here is an example of player set to reproduce this issue.
http://elchonon.com/shakarewind/

The above player points to an MPD edited from the original "https://storage.googleapis.com/shaka-demo-assets/tos-pto-webvtt/dash.mpd" mpd, referencing its periods numerous times adding up to 70 periods and a duration of 89 minutes.

We were not able to consistently reproduce with the original mpd so we made this very long mpd with many periods which seems to be a factor in being able to consistently reproduce.

The player is Shaka compiled in debug mode, compiled 1/7/2017 from the master branch.

The player is set to begin at 421 seconds and jump back to 411 seconds and then it hangs.

We've encountered this consistently with private content of 1hr+ durations and 20+ periods and we are reproducing it here with this content.

@salmoro salmoro changed the title Player hangs indefinitely on a multi-period mpd, when skipping ahead and then behind. Player hangs indefinitely on a multi-period mpd when skipping ahead and then behind. Jan 12, 2017
@TheModMaker TheModMaker self-assigned this Jan 12, 2017
@TheModMaker TheModMaker added status: bad content Caused by invalid, broken, or unsupported content and removed status: bad content Caused by invalid, broken, or unsupported content labels Jan 12, 2017
@TheModMaker
Copy link
Contributor

The problem with your custom manifest is you generated the manifest incorrectly. The first two periods should be 60 seconds and the third is 120 seconds. You have it where the second period is 120 seconds, which is causing problems.

You can see the problem by just playing the manifest from the beginning. Once it gets to 120 seconds it stops because it is still looking for more content in that period, but can't find it.

It is also possible the original issue was the same as #649. I cannot reproduce any issue with the original manifest.

@joeyparrish joeyparrish added the status: bad content Caused by invalid, broken, or unsupported content label Jan 12, 2017
@salmoro
Copy link
Author

salmoro commented Jan 13, 2017

Thanks! Good catch there and my apologies for the bad content. It was edited by hand. Now that we corrected the MPD, the issue on the sample persists no more. Our original issue does seem similar to #649. We'll test our private content with Chrome 56 and see if that resolves it. Otherwise we'll have to figure out another way to reproduce the problem. Thanks very much for your help.

@salmoro salmoro closed this as completed Jan 13, 2017
@salmoro
Copy link
Author

salmoro commented Jan 22, 2017

Here I've managed to reproduce this

See the programmed player here:
https://dwnmi3sz90i0g.cloudfront.net/

And here is the MPD it's pointing to which plays well (beginning to end) on all Shaka versions tested (including Shaka demo player):
https://s3.amazonaws.com/aws-website-shaka-rewind-a9cdr/dash.mpd

Important Note:
We've only been able to reproduce this consistently with slower computers (i5 dual core and some quad) and with cache cleared. Not sure if this is a function of CPU or RAM (or GPU or something else)but it is important to point out that on some computers it's not possible to reproduce.

We've tried this on multiple versions of Chrome including Canary, Version 58.0.2989.0 and we're getting the same results. We've also seen this consistently on Firefox.

Here's what the player does: Begins player at 480.033 (seconds), after an initial delay of 1 seconds it repeats 5 times a rewind of 10 seconds with a 0.5 seconds delay in between. Ultimately the player gets to 7:10 (480-5x10) and will not play.

The player up above is running on shaka-player.compiled.debug.js (compiled 1/7/2017 from the master branch). So you can monitor console for errors and warnings.

Specs of computers that consistently reproduced:
-Intel i5-4210u 2.40 GHz, 8GB RAM - Windows 7-64
-Intel i5-4590 3.30 GHz, 8GB RAM - Windows 7-64
-Intel i3-m370 2.40 GHz, 4GB RAM - Windows 7-64

Specs of computer that consistently didn't reproduce:
-Intel i7-6800k 3.40 GHz, 16GB RAM - Windows 10-64

Please let me know if there's anything else you need.
Thanks

@salmoro salmoro reopened this Jan 22, 2017
@joeyparrish joeyparrish removed the status: bad content Caused by invalid, broken, or unsupported content label Jan 23, 2017
@TheModMaker
Copy link
Contributor

The problem here is that Chrome doesn't seem to jump gaps after a seek. It will usually jump gaps up to 0.5 seconds, even at the beginning of playback. But if you seek to an unbuffered region that is right behind a buffered range, Chrome won't play. You just happen to seek into the <0.1 second range that is needed to cause this. You can see this by seeking to 440 and pausing, letting it buffer, then seeking to 430.05 (just before the buffered segment).

I'll have a fix up soon.

shaka-bot pushed a commit that referenced this issue Jan 23, 2017
Chrome doesn't seem to support gap jumping immediately after a seek.
So when we detect how much is buffered after a seek, we should use the
exact ranges.  Otherwise we will be left with a small gap that Chrome
doesn't want to jump.

Issue #655

Change-Id: I2d853e0c2b95285013463f38cece56ea9ea56133
@TheModMaker
Copy link
Contributor

That bug has been fixed on master. Please try again with the latest code.

@salmoro
Copy link
Author

salmoro commented Jan 24, 2017

Thanks! Will test and confirm.

@salmoro
Copy link
Author

salmoro commented Jan 24, 2017

TheModMaker,
On the above linked content, your fix actually worked (here it is with the latest player). Yet we have private content which still seems to maintain resembling issues.
Would it be possible for us to PM you a link to our content?
Thanks!

@TheModMaker
Copy link
Contributor

Sure, my email is in CONTRIBUTORS (I'm Jacob).

@wader
Copy link

wader commented Jan 24, 2017

Hi, I got a similar issue to this (or #649) but at playback start. A bit randomly (more often for DRM content) shaka downloads some fragments and then gets stuck.

What seems to happen is that in shaka.media.Playhead.prototype.onWatchdogTimer_ the call shaka.media.TimeRangesUtils.bufferedAheadOf( this.video_.buffered, this.video_.currentTime); always returns 0. This is because currentTime is stuck at the same value and in bufferedAheadOf that value is less then the buffered time range start.

In onWatchdogTimer_:

> this.video_.readyState
4
> this.video_.currentTime
0.025315
> this.video_.paused
false

In bufferedAheadOf:

> b.length
1
> b.start(0)
0.08
> b.end(0)
12.08
> time
0.025315

Works fine if I reverting fb8174d where currentTime is not involved in figuring out buffered time.

This is with CEF 3.2785.1486 which I think is Chromium 53.

Could it be related to https://bugs.chromium.org/p/chromium/issues/detail?id=675556 that is mentioned in #649?

Any help would be really appreciated!

@wader
Copy link

wader commented Jan 24, 2017

@joeyparrish any ideas?

@TheModMaker TheModMaker added the type: bug Something isn't working correctly label Jan 24, 2017
@TheModMaker TheModMaker added this to the v2.1.0 milestone Jan 24, 2017
@joeyparrish
Copy link
Member

@wader, try a new version of CEF (based on Chromium 56) and see if it is the same as #649. Otherwise, please file a new bug with a specific piece of content so we can reproduce your error.

@wader
Copy link

wader commented Jan 25, 2017

@joeyparrish Ok will try. Hopefully I can reproduce it with the CEF test app. It's a bit tricky to update CEF for the application i'm working on (API change etc).

Do you remember the reason for changing to shaka.media.TimeRangesUtils.bufferedAheadOf? should bufferedAheadOf be changed to allow to jump a small gap in the beginning if time argument is before first buffer time rage? but i'm not sure I follow why currentTime is not 0 in our case hmm. Sorry for rambling 😄

@joeyparrish
Copy link
Member

@wader, no worries. bufferedAheadOf does some additional logic on top of just checking buffered. We use it to determine whether or not playback can continue, so we have to predict what sort of gaps the browser will be willing to jump. I'll admit, it's a little complicated, but it's because we're coping with a complicated and opaque browser behavior.

Judging from the investigation by @TheModMaker, it does not appear that bufferedAheadOf is the culprit. We'll keep you posted as we make progress.

shaka-bot pushed a commit that referenced this issue Jan 27, 2017
First, Player should not call AbrManager.setVariants as part of load().
Before, it would set them for the first Period; however, this doesn't
work with a start time in another Period.  StreamingEngine will call
chooseStreams_ for the starting Period before startup finishes.

Second, we should handle Period transitions before we handle buffering
goal.  Before, we would wait until the playhead moves closer to the
Period transition even if we have buffered the entire Period.  This
can cause problems when seeking, especially with text content that
buffers quickly.  If we seek and we have buffered text but not video,
the pipeline will stall since text is waiting for the playhead to move
while video is waiting for the Period transition.

Lastly, it is possible for multiple Period transitions to occur closely
together.  If we seek into a Period that is not setup yet, and then
seek back to a Period that is setup, then the second transition will
complete and the first will override it once it finishes setting up
the Period.  We should stop any old transitions if another starts.

Issue #655

Change-Id: Iab8961c606a65487704c9f0efaa255db0e3dc942
@TheModMaker
Copy link
Contributor

@salmoro I just pushed another fix that should fix the repro you sent me. Please try again.

joeyparrish pushed a commit that referenced this issue Jan 28, 2017
Chrome doesn't seem to support gap jumping immediately after a seek.
So when we detect how much is buffered after a seek, we should use the
exact ranges.  Otherwise we will be left with a small gap that Chrome
doesn't want to jump.

Issue #655

Change-Id: I2d853e0c2b95285013463f38cece56ea9ea56133
joeyparrish pushed a commit that referenced this issue Jan 28, 2017
First, Player should not call AbrManager.setVariants as part of load().
Before, it would set them for the first Period; however, this doesn't
work with a start time in another Period.  StreamingEngine will call
chooseStreams_ for the starting Period before startup finishes.

Second, we should handle Period transitions before we handle buffering
goal.  Before, we would wait until the playhead moves closer to the
Period transition even if we have buffered the entire Period.  This
can cause problems when seeking, especially with text content that
buffers quickly.  If we seek and we have buffered text but not video,
the pipeline will stall since text is waiting for the playhead to move
while video is waiting for the Period transition.

Lastly, it is possible for multiple Period transitions to occur closely
together.  If we seek into a Period that is not setup yet, and then
seek back to a Period that is setup, then the second transition will
complete and the first will override it once it finishes setting up
the Period.  We should stop any old transitions if another starts.

Issue #655

Change-Id: Iab8961c606a65487704c9f0efaa255db0e3dc942
@salmoro
Copy link
Author

salmoro commented Jan 31, 2017

@TheModMaker
Thanks! We've been since trying the player with the most recent changes and while it has solved the immediate rewind to a previous period case, we've noticed that if we continue skipping backwards 10 seconds at a time after player stops buffering, it'll ultimately hang, usually once it gets back into an even earlier period.
Again, we had trouble reproducing on public content and it'll be easier if we can PM you a link.
Thanks very much.

@salmoro
Copy link
Author

salmoro commented Feb 6, 2017

Is this still included in the milestone of v2.1.0?

shaka-bot pushed a commit that referenced this issue Feb 7, 2017
Before, we would treat each buffer separately when deciding to clear
when seeking.  However, this can cause problems because the media
states can end up needing different Periods.

For example: we are in Period 2 and seek backwards into Period 1 where
we have buffered text but not video.  The text media state will need
Period 2 since it is buffered; but the video media state will need
Period 1.  For both states, the "current" Period is 2, so the video
state will try to handle a Period transition.  This will cause an
indefinite hang since text state will never need Period 1.

Issue #655

Change-Id: I9d03c0378481b412a79eef205cd647ec9895a8d7
@TheModMaker
Copy link
Contributor

Sorry for the delay, just pushed a change that should fix your latest issue. These fixes will appear in v2.1, some have been cherry-picked into v2.0.x.

@salmoro
Copy link
Author

salmoro commented Feb 9, 2017

Thanks. We're currently testing. With the latest code, so far we cannot seem to reproduce. Will confirm.

@TheModMaker TheModMaker added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Feb 10, 2017
joeyparrish pushed a commit that referenced this issue Feb 10, 2017
Before, we would treat each buffer separately when deciding to clear
when seeking.  However, this can cause problems because the media
states can end up needing different Periods.

For example: we are in Period 2 and seek backwards into Period 1 where
we have buffered text but not video.  The text media state will need
Period 2 since it is buffered; but the video media state will need
Period 1.  For both states, the "current" Period is 2, so the video
state will try to handle a Period transition.  This will cause an
indefinite hang since text state will never need Period 1.

Issue #655

Change-Id: I9d03c0378481b412a79eef205cd647ec9895a8d7
@salmoro
Copy link
Author

salmoro commented Feb 10, 2017

Bug seems to have been fixed. TYVM!

@salmoro salmoro closed this as completed Feb 10, 2017
@TheModMaker
Copy link
Contributor

Glad that it is fixed. Thanks for sticking with this and providing easy reproductions.

@TheModMaker TheModMaker removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Feb 10, 2017
@salmoro
Copy link
Author

salmoro commented Feb 13, 2017

Thanks for the fantastic support.

@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

5 participants