-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 during initial update_ fetches all segments from 0 seconds to the seek location #3299
Comments
You can pass initial start time via config and then shaka optimizes loading from that point. |
@OrenMe thanks for the suggestion, but during the This ticket is about making seeking more predictable, intuitive, and well-defined. It does look like a bug at the first glance. |
I was able to reproduce on Firefox, but not Chrome for some reason. I was also able to reproduce on the nightly site. |
I have just observed similar behaviour with 3.1.0 on Chrome, seeking HLS content. However this doesn't just occur during initial update_(). After several arbitrary seeks, the streaming engine gets stuck buffering segments to catch up with the new playback position, instead of buffering from the seek target. Playback resumes when segments are finally buffered beyond the presentation time. Here is an example seeking to presentation time 5734: |
This seems to be resolved by also clearing the buffer under the condition I can reproduce this fairly reliably with two unbuffered seeks in close succession (takes a bit of trial and error to get the interval timing just right), but not at all with the above change. |
Previously, we only cleared the buffer if the media state had something buffered. This ensured that we did not pointlessly clear the buffer when nothing was there. However, this lead to problems if a seek was performed early during the loading process, before the source buffer is initialized. During that time, nothing is buffered, so we would not clear the buffer on a seek. This lead to us accidentally fetching content from the beginning of the presentation, rather than starting from the new clock time. This changes the streaming engine to also clear the buffer if mediaState.performingUpdate is true, to avoid that situation. Closes #3299
Previously, we only cleared the buffer if the media state had something buffered. This ensured that we did not pointlessly clear the buffer when nothing was there. However, this lead to problems if a seek was performed early during the loading process, before the source buffer is initialized. During that time, nothing is buffered, so we would not clear the buffer on a seek. This lead to us accidentally fetching content from the beginning of the presentation, rather than starting from the new clock time. This changes the streaming engine to also clear the buffer if mediaState.performingUpdate is true, to avoid that situation. Closes #3299
Previously, we only cleared the buffer if the media state had something buffered. This ensured that we did not pointlessly clear the buffer when nothing was there. However, this lead to problems if a seek was performed early during the loading process, before the source buffer is initialized. During that time, nothing is buffered, so we would not clear the buffer on a seek. This lead to us accidentally fetching content from the beginning of the presentation, rather than starting from the new clock time. This changes the streaming engine to also clear the buffer if mediaState.performingUpdate is true, to avoid that situation. Closes #3299
Previously, we only cleared the buffer if the media state had something buffered. This ensured that we did not pointlessly clear the buffer when nothing was there. However, this lead to problems if a seek was performed early during the loading process, before the source buffer is initialized. During that time, nothing is buffered, so we would not clear the buffer on a seek. This lead to us accidentally fetching content from the beginning of the presentation, rather than starting from the new clock time. This changes the streaming engine to also clear the buffer if mediaState.performingUpdate is true, to avoid that situation. Closes #3299
Have you read the FAQ and checked for duplicate open issues?
Yes.
What version of Shaka Player are you using?
v3.0.10.
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 app.
If custom app, can you reproduce the issue using our demo app?
Not sure.
What browser and OS are you using?
MacOS 11.2.2, Firefox 87.
For embedded devices (smart TVs, etc.), what model and firmware version are you using?
N/A
What are the manifest and license server URIs?
N/A
What configuration are you using? What is the output of
player.getConfiguration()
?N/A
What did you do?
Seek soon after "loadedmetadata". For example:
What did you expect to happen?
Video should stop buffering at current playhead (t=0), then seek to the requested time (t=165), and from there buffer bufferingGoal (30 s, in this case) of data.
What actually happened?
It started downloading segments from t=0 to t=165+bufferingGoal. So it downloaded 195 seconds of data instead of downloading 30 seconds (bufferingGoal) of data.
It does appear that calling
this.forceClearBuffer_(mediaState)
inseeked()
(streaming_engine.js) solves the problem. Note that it's not deterministic, but I think with the current test setup I can reproduce it ~9/10 times (so I still may be missing something).My current interpretation of v2 logs is that something like this is happening:
update_()
is called for the first time and starts to download dataseeked()
somethingBuffered
returns falsesomethingBuffered
being falseforceClearBuffer
is not calledforceClearBuffer
is not called, the originalupdate_
is not interruptedPart of the log when this happens:
Is it possible that something like this is happening?
The text was updated successfully, but these errors were encountered: