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

[MSS] use new settings system for MSSParser buffer configuration #3063

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/mss/parser/MssParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function MssParser(config) {
const constants = config.constants;
const manifestModel = config.manifestModel;
const mediaPlayerModel = config.mediaPlayerModel;
const settings = config.settings;

const DEFAULT_TIME_SCALE = 10000000.0;
const SUPPORTED_CODECS = ['AAC', 'AACL', 'AVC1', 'H264', 'TTML', 'DFXP'];
Expand Down Expand Up @@ -698,16 +699,20 @@ function MssParser(config) {
if (manifest.type === 'dynamic') {
let targetLiveDelay = mediaPlayerModel.getLiveDelay();
if (!targetLiveDelay) {
targetLiveDelay = segmentDuration * mediaPlayerModel.getLiveDelayFragmentCount();
targetLiveDelay = segmentDuration * settings.get().streaming.liveDelayFragmentCount;
}
let targetDelayCapping = Math.max(manifest.timeShiftBufferDepth - 10/*END_OF_PLAYLIST_PADDING*/, manifest.timeShiftBufferDepth / 2);
let liveDelay = Math.min(targetDelayCapping, targetLiveDelay);
mediaPlayerModel.setLiveDelay(liveDelay);
// Consider a margin of one segment in order to avoid Precondition Failed errors (412), for example if audio and video are not correctly synchronized
let bufferTime = liveDelay - segmentDuration;
mediaPlayerModel.setStableBufferTime(bufferTime);
mediaPlayerModel.setBufferTimeAtTopQuality(bufferTime);
mediaPlayerModel.setBufferTimeAtTopQualityLongForm(bufferTime);
settings.update({
'streaming': {
'liveDelay': liveDelay,
'stableBufferTime': bufferTime,
'bufferTimeAtTopQuality': bufferTime,
'bufferTimeAtTopQualityLongForm': bufferTime
}
});
}

// Delete Content Protection under root manifest node
Expand Down
3 changes: 2 additions & 1 deletion src/streaming/MediaPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1972,7 +1972,8 @@ function MediaPlayer() {
debug: debug,
initSegmentType: HTTPRequest.INIT_SEGMENT_TYPE,
BASE64: BASE64,
ISOBoxer: ISOBoxer
ISOBoxer: ISOBoxer,
settings: settings
});
}
}
Expand Down