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

Seeking race condition on Firefox #569

Closed
boredom2 opened this issue Oct 27, 2016 · 12 comments
Closed

Seeking race condition on Firefox #569

boredom2 opened this issue Oct 27, 2016 · 12 comments
Assignees
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@boredom2
Copy link

Hi there,

Version 2.0.0 was running fine on Chrome and Firefox.
Version 2.0.1 runs fine on Chrome, but on Firefox, I receive hundreds of "seeking", "seeked", "seeking"... Messages and a very long "stalled" Period afterwards. By Hitting Pause/Play, if then works, but without, it simply does not start anymore.
Additionally - since 2.0.1, the highest Quality is ALWAYS chosen initially. Is this intended?

Thanks,
Christoph

@joeyparrish joeyparrish added the type: question A question from the community label Oct 27, 2016
@joeyparrish
Copy link
Member

v2.0.1 makes faster adaptation decisions than v2.0.0 did. This is intentional, and based on feedback that Shaka sometimes took tens of seconds to adapt when playback started. See 8152e64 for the commit.

It's not instant, though. The time first choice is very low, less than one second for fast connections. The time to that choice being visible on screen depends on many factors, but primarily buffering goal and segment size. In my tests with 4 second segments, 10 second buffering goal, and ample bandwidth, I see visual changes after 8 seconds. Until then, the resolution is determined by the default bandwidth estimate, which is configurable.

I haven't seen any issues with seeking events on Firefox. Can you reproduce with our demo app, or only with your own app? Can you provide a steps to reproduce? (Next time you file an issue, please use our template.)

@cpeterso
Copy link

@boredom2: on which operating systems do you see this Firefox seeking problem? Do you see this problem with all streams?

@boredom2
Copy link
Author

Hi there, sorry - you are right, I should have used the Template (was too early for me :P).

I can reproduce this Issue also on your Demo Page - but not with all Manifests. The YouTube Manifests run fine, the Azure Media Services Trailer has the same Effect. Due to the fact, that we are also using Azure Media Services heavily - there might be the Problem.

I use: Firefox 49.02 on Windows 10, Anniversary Update with all available Updates.
The Connection is a 7MBps Connection - not extremely fast, but for sure fast enough to run YT HD nearly without Delay, so that shouldnt be an Issue...

shaka

@danpeters76
Copy link

We're seeing the same issue with 2.0.1 on Firefox 49.0.2 for streams generated by Unified Streaming Platform both for our own content and the sample content within the shaka demo player (Tears of Steel - Widevine). In both cases we've tested so far on OSX.

These streams are working fine using Shaka 2.0.1 on Chrome.

Steps to replicate:

  1. Load a unified streaming platform generated stream
  2. Scrub to middle of video file
  3. In most cases video will pause and not restarting, throwing the warning "The last segment should not end before the end of the Period." in the console.
  4. In some cases if you leave the file playback restarts 1 or 2 minutes later

thanks,

Dan

@cpeterso
Copy link

cpeterso commented Oct 28, 2016

Using the steps provided by @danpeters76, I can reproduce the buffering problem with Firefox on Windows 10 and Mac OS X 10.12, though I don't see any console errors. The stream resumes within 1-2 seconds in Chrome and Edge, but buffers for about 1-2 minutes in Firefox before resuming.

I reproduce the problem any of the Shaka demo streams, not just the United Streaming streams. I don't think this is a Firefox regression because I can reproduce the stall with older versions of Firefox (45-49).

Are older versions of the Shaka demo player archived online? That would make regression testing easier. I only tested the current Shaka v2.0.1-debug demo player:

http://shaka-player-demo.appspot.com/demo/

@cpeterso
Copy link

I filed Firefox bug 1313806 to investigate this problem from the Mozilla side. The Shaka 2.0.1 code works in Chrome, IE11, and Edge, so Firefox should try to be compatible.

Safari (macOS 10.12.1) has a different seeking problem with current Shaka demo: the audio begins playing at the new seek position, but the video doesn't start playing unless you manually pause and resume playback.

@jyavenard
Copy link

2ecd8bb is the first bad commit
commit 2ecd8bb
Author: Joey Parrish joeyparrish@google.com
Date: Wed Oct 19 13:07:47 2016 -0700

Flush Chromecast pipeline after clearing buffer

To work around a bug in Chromecast, seek after clearing the buffer.
This forces the device to flush the pipeline and remove any decoded
data from the old representation.

Closes #544

Change-Id: I3c34d344bfd856b429a360fc41ce7288791716bb

jyavenard pushed a commit to jyavenard/shaka-player that referenced this issue Nov 1, 2016
In commit 2ecd8bb, as workaround for a chromecast bug, whenever the sourcebuffer is cleared, a new seek is initiated in order to flush the media pipeline.
However, this can cause an infinite loop if a seek is already pending.

Fixes shaka-project#569.
@jyavenard
Copy link

Here is a quick fix. I'm not familiar with shaka code so it may not be how you would have done it.
The issue at hand here is that the media pipeline is flushed when a seek is initiated. However, this flushing is done by seeking again. So you get something like seek -> clear -> flush (seek) -> seek -> clear -> flush (seek) -> repeat

The current code is racy in such that it relies on an event (seeking/seeked) be fired in a specific order, order not defined in the spec.

So the work around is to not attempt to clear the media pipeline while we're seeking. It's more efficient that way anyway as when you're seeking there's no need to flush the pipeline (it's already been flushed). This will speed up seeking on all user agents.

It fixes the issue mentioned by @cpeterso above with Safari slightly, but there's still something wrong there. Sometimes after seeking it displayed the Halloween message until you pause and play again. But this appears to be irrelevant of 2.0.0 vs 2.0.1

@joeyparrish
Copy link
Member

@jyavenard, can you please clarify what your fix is? I don't see any code here. Can you submit a PR?

@joeyparrish joeyparrish changed the title Shaka 2.0.1 and FireFox Seeking race condition on Firefox Nov 1, 2016
@joeyparrish joeyparrish added type: bug Something isn't working correctly and removed type: question A question from the community labels Nov 1, 2016
@joeyparrish joeyparrish added this to the v2.1.0 milestone Nov 1, 2016
@jyavenard
Copy link

The link was above: jyavenard@2310754

Will do a PR

@joeyparrish
Copy link
Member

I just managed to reproduce this bug on Chrome by rapidly seeking. The system got stuck in a seek loop, which eventually resolved after many hundred iterations.

@cpeterso, I believe this is not Firefox's fault. I hope you haven't spent too much time investigating on the Mozilla side.

shaka-bot pushed a commit that referenced this issue Nov 28, 2016
Rather than flushing implicitly when clearing the buffer, flush
explicitly in some circumstances.  In particular, do not flush on
unbuffered seeks.  Flushing uses seeking, so flushing on seek
creates a race condition that may cause a nasty loop.

Issue #569

Change-Id: I61489b13100b56a5316a8313a1b2782dc242f858
@joeyparrish
Copy link
Member

I pushed a commit that should fix this. Please let us know if that's not the case, and I can reopen.

Ross-cz pushed a commit to Ross-cz/shaka-player that referenced this issue Nov 29, 2016
Rather than flushing implicitly when clearing the buffer, flush
explicitly in some circumstances.  In particular, do not flush on
unbuffered seeks.  Flushing uses seeking, so flushing on seek
creates a race condition that may cause a nasty loop.

Issue shaka-project#569

Change-Id: I61489b13100b56a5316a8313a1b2782dc242f858
joeyparrish added a commit that referenced this issue Nov 30, 2016
Rather than flushing implicitly when clearing the buffer, flush
explicitly in some circumstances.  In particular, do not flush on
unbuffered seeks.  Flushing uses seeking, so flushing on seek
creates a race condition that may cause a nasty loop.

Issue #569

Change-Id: I61489b13100b56a5316a8313a1b2782dc242f858
@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

Successfully merging a pull request may close this issue.

6 participants