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

Fix regression for live delay computation #3314

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/streaming/controllers/StreamController.js
Expand Up @@ -650,6 +650,13 @@ function StreamController() {
}

if (!activeStream) {
if (adapter.getIsDynamic() && streams.length) {
// Compute and set live delay
const manifestInfo = streamsInfo[0].manifestInfo;
const fragmentDuration = getFragmentDurationForLiveDelayCalculation(streamsInfo, manifestInfo);
playbackController.computeAndSetLiveDelay(fragmentDuration, manifestInfo.DVRWindowSize, manifestInfo.minBufferTime);
}

// we need to figure out what the correct starting period is
const startTimeFormUriParameters = playbackController.getStartTimeFromUriParameters();
let initialStream = null;
Expand All @@ -676,11 +683,8 @@ function StreamController() {

function getInitialStream() {
try {
const streamInfos = adapter.getStreamsInfo(undefined);
const manifestInfo = streamInfos[0].manifestInfo;
const liveEdge = timelineConverter.calcPresentationTimeFromWallTime(new Date(), adapter.getRegularPeriods()[0]);
const fragmentDuration = getFragmentDurationForLiveDelayCalculation(streamInfos, manifestInfo);
const targetDelay = playbackController.computeAndSetLiveDelay(fragmentDuration, manifestInfo.DVRWindowSize, manifestInfo.minBufferTime);
const targetDelay = playbackController.getLiveDelay();
const targetTime = liveEdge - targetDelay;

return getStreamForTime(targetTime);
Expand Down