dash.js icon indicating copy to clipboard operation
dash.js copied to clipboard

Fix rerequest segment on quality switch

Open chanh1964 opened this issue 3 years ago • 2 comments

This PR fixes #3792 - Player re-requests the latest segment on quality change.

I found out that the function StreamProcessor.setExplicitBufferingTime might be wrongly used in StreamProcessor._bufferClearedForNonReplacement. I think StreamProcessor._bufferClearedForNonReplacement is called when the player doesn't need to replace any segment in the buffer, as default. So StreamProcessor.setExplicitBufferingTime should not be called.

I also noticed, in StreamProcessor._prepareForDefaultQualitySwitch, there's the comment "We might have aborted the current request. We need to set an explicit buffer time based on what we already have in the buffer". Isn't this case already handled in StreamProcessor._onFragmentLoadingAbandoned?

Therefore, I have removed the setExplicitBufferingTime in _bufferClearedForNonReplacement. Seems the issue is fixed.

chanh1964 avatar Oct 25 '21 08:10 chanh1964

I'm sorry.

Except https://github.com/Dash-Industry-Forum/dash.js/pull/3797/commits/754b6be02439dca51d6a10a3568451676bcc044b, the other 10 commits were from #3785. I don't know why they were also added to this PR.

chanh1964 avatar Oct 25 '21 08:10 chanh1964

Thanks for this @chanh1964 , I need to check this in detail

Regarding: _" Isn't this case already handled in StreamProcessor.onFragmentLoadingAbandoned"

One thing to keep in mind is that _onFragmentLoadingAbandoned only takes effect if !scheduleController.getSwitchStrack() .

Actually there is also a typo in the function :)

dsilhavy avatar Oct 26 '21 07:10 dsilhavy

@chanh1964 Thanks for the PR, I did some modifications to account for edge cases in #4144 . I am closing this

dsilhavy avatar Mar 21 '23 07:03 dsilhavy