-
Notifications
You must be signed in to change notification settings - Fork 425
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
Multi period dash VOD fixes #1551
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f6fd00b
chore: clear previous dash media request timeout everytime we clear o…
626123f
chore: call fast-quality-switch only when we enable playlist from qua…
0a44def
chore: add isPaused for dash playlist loader to mitigate duplicate pl…
3ddeea3
chore: fix fastQualityChange_ tests
d1f43c7
chore: add fast quality change debounce
3c74bd2
chore: add debounce tick to the tests
4d4b751
chore: restart all loaders when we hit fix bad timeline change
231b4bb
chore: update segment loader
140eec3
chore: update run-fast-quality-switch and fix bad timeline changes
dzianis-dashkevich d72e2e9
Merge branch 'main' of github.com:videojs/http-streaming into multi-p…
dzianis-dashkevich 604a643
fix test
dzianis-dashkevich fd15e60
chore: fix lint issues
dzianis-dashkevich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
import { addMetadata, createMetadataTrackIfNotExists, addDateRangeMetadata } from './util/text-tracks'; | ||
import ContentSteeringController from './content-steering-controller'; | ||
import { bufferToHexString } from './util/string.js'; | ||
import {debounce} from './util/fn'; | ||
|
||
const ABORT_EARLY_EXCLUSION_SECONDS = 10; | ||
|
||
|
@@ -152,6 +153,11 @@ | |
constructor(options) { | ||
super(); | ||
|
||
// Adding a slight debounce to avoid duplicate calls during rapid quality changes, for example: | ||
// When selecting quality from the quality list, | ||
// where we may have multiple bandwidth profiles for the same vertical resolution. | ||
this.fastQualityChange_ = debounce(this.fastQualityChange_.bind(this), 100); | ||
|
||
const { | ||
src, | ||
withCredentials, | ||
|
@@ -701,7 +707,16 @@ | |
|
||
if (this.sourceType_ === 'dash') { | ||
// we don't want to re-request the same hls playlist right after it was changed | ||
this.mainPlaylistLoader_.load(); | ||
|
||
// Initially it was implemented as workaround to restart playlist loader for live | ||
// when playlist loader is paused because of playlist exclusions: | ||
// see: https://github.com/videojs/http-streaming/pull/1339 | ||
// but this introduces duplicate "loadedplaylist" event. | ||
// Ideally we want to re-think playlist loader life-cycle events, | ||
// but simply checking "paused" state should help a lot | ||
if (this.mainPlaylistLoader_.isPaused) { | ||
this.mainPlaylistLoader_.load(); | ||
} | ||
} | ||
|
||
// TODO: Create a new event on the PlaylistLoader that signals | ||
|
@@ -962,6 +977,24 @@ | |
this.tech_.setCurrentTime(newTime); | ||
}); | ||
|
||
this.timelineChangeController_.on('fixBadTimelineChange', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also love moving this to the playlist-controller level. 🥇 |
||
// pause, reset-everything and load for all segment-loaders | ||
this.logger_('Fix bad timeline change. Restarting al segment loaders...'); | ||
this.mainSegmentLoader_.pause(); | ||
this.mainSegmentLoader_.resetEverything(); | ||
if (this.mediaTypes_.AUDIO.activePlaylistLoader) { | ||
this.audioSegmentLoader_.pause(); | ||
this.audioSegmentLoader_.resetEverything(); | ||
} | ||
if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) { | ||
this.subtitleSegmentLoader_.pause(); | ||
this.subtitleSegmentLoader_.resetEverything(); | ||
} | ||
|
||
// start segment loader loading in case they are paused | ||
this.load(); | ||
}); | ||
|
||
this.mainSegmentLoader_.on('earlyabort', (event) => { | ||
// never try to early abort with the new ABR algorithm | ||
if (this.bufferBasedABR) { | ||
|
@@ -1109,13 +1142,19 @@ | |
|
||
runFastQualitySwitch_() { | ||
this.waitingForFastQualityPlaylistReceived_ = false; | ||
// Delete all buffered data to allow an immediate quality switch. | ||
this.mainSegmentLoader_.pause(); | ||
this.mainSegmentLoader_.resetEverything(() => { | ||
this.mainSegmentLoader_.load(); | ||
}); | ||
this.mainSegmentLoader_.resetEverything(); | ||
if (this.mediaTypes_.AUDIO.activePlaylistLoader) { | ||
this.audioSegmentLoader_.pause(); | ||
this.audioSegmentLoader_.resetEverything(); | ||
} | ||
if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) { | ||
this.subtitleSegmentLoader_.pause(); | ||
this.subtitleSegmentLoader_.resetEverything(); | ||
} | ||
|
||
// don't need to reset audio as it is reset when media changes | ||
// start segment loader loading in case they are paused | ||
this.load(); | ||
} | ||
|
||
/** | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export const debounce = (callback, wait) => { | ||
let timeoutId = null; | ||
|
||
return (...args) => { | ||
clearTimeout(timeoutId); | ||
|
||
timeoutId = setTimeout(() => { | ||
callback.apply(null, args); | ||
}, wait); | ||
}; | ||
}; |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Thank you for actually adding this! This has been on my list of "quick improvements" to fast quality change for a while and keeps getting buried by other priorities.