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
Bugfix for subtitle loading after hls.stopload() was used #3063
Merged
robwalch
merged 16 commits into
video-dev:master
from
netTrekfd:bugfix/subtitle-loading-after-stopload
Oct 8, 2020
Merged
Changes from 10 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
cbe8f87
Reset subtitle-stream-controller state to IDLE on startLoad()
netTrekfd f2aadf7
Cleanup any existing intervals and call tick() immediately
netTrekfd ad80f18
Only restart interval if we have a current track
netTrekfd 2736608
Fix stop loading wrong segment order after initial seek
netTrekfd cbd0b77
Reset subtitle-stream-controller state to IDLE on startLoad()
netTrekfd dc3ebff
Cleanup any existing intervals and call tick() immediately
netTrekfd bc1512d
Only restart interval if we have a current track
netTrekfd 30b76ea
Fix stop loading wrong segment order after initial seek
netTrekfd b29432d
Merge branch 'bugfix/subtitle-loading-after-stopload' of https://gith…
netTrekfd 991de69
Refactored fix for segment loading order after seeking
netTrekfd d63cf0c
Update src/controller/subtitle-stream-controller.js
netTrekfd d107216
Cancel existing loader on errors
netTrekfd be2e12b
Added some checks if the seeking position is inside the currently loa…
netTrekfd fe219db
Update src/controller/subtitle-stream-controller.js
netTrekfd d67865a
Removed comment
netTrekfd b93c938
Merge branch 'bugfix/subtitle-loading-after-stopload' of https://gith…
netTrekfd File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good. It makes sense and it is a step in the right direction. Here's the catch:
Aborting the request should only be done when seeking outside the range of
fragCurrent
. When seeking a bit within the range of this fragment, loading would just be forced to start over. The key to the logic in base-stream-controller's onMediaSeeking is that it deals with this issue for audio and video. The difference is base-stream-controller relies onBufferHelper.bufferInfo(media
and here we need to useBufferHelper.bufferInfo(this._getBuffered()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's quite a bit of duplicate code that could be addressed by changing_getBuffered
toget mediaBuffer
and using the base controller'sonMediaSeeking
logic, so maybe give that a try. It's certainly something I'd like to have in v1.The suggested change above duplicates some code but that's OK. This will be addressed in v1.0.0 by exposing the buffered time ranged in the subtitle-stream-controller as a
mediaBuffer
property: https://github.com/video-dev/hls.js/pull/3060/files#diff-9f7fbd2b9b9e7d0824937236683db215R47-R295 which is dealt with the same for all stream controllers in base-stream-controllersonMediaSeeking
handler.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, i will take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @robwalch ,
i just added some changes here be2e12b.
Unfortunately the check
state === stateState.FRAG_LOADING
did not work for me. As soon as i check for that state i'm easily able to reproduce the issue by seeking slowly backwards. There is probably a loader running and needs to be cancelled even if the state does not reflect it.I also did some tests with the buffering test
BufferHelper.bufferInfo(this._getBuffered()
but am not sure if i got your suggestion right. The root of this problem is that as soon as a loader is running, it continues to load in the order given by the last loaded segment. Because of that i think we need to cancel the fragCurrent.loader independend of the fact we are seeking to an already buffered position. The buffer will be respected inside the next tick.As soon as i do not cancel the loader when seeking to an already buffered position, it will keep loading from the previous position which caused the problem.
I hope this is understandable. If not, i will try to explain it better ;)
Thanks
Florian