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

Optimize live start #3283

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/streaming/StreamProcessor.js
Expand Up @@ -75,6 +75,7 @@ function StreamProcessor(config) {
let boxParser = config.boxParser;

let instance,
logger,
isDynamic,
mediaInfo,
mediaInfoArr,
Expand All @@ -86,6 +87,7 @@ function StreamProcessor(config) {
streamInitialized;

function setup() {
logger = Debug(context).getInstance().getLogger(instance);
resetInitialSettings();

eventBus.on(Events.STREAM_INITIALIZED, onStreamInitialized, instance);
Expand Down Expand Up @@ -645,7 +647,9 @@ function StreamProcessor(config) {

const currentRepresentationInfo = getRepresentationInfo();
const liveEdge = liveEdgeFinder.getLiveEdge(currentRepresentationInfo);
const startTime = liveEdge - playbackController.computeLiveDelay(currentRepresentationInfo.fragmentDuration, currentRepresentationInfo.mediaInfo.streamInfo.manifestInfo.DVRWindowSize);
const liveDelay = playbackController.computeLiveDelay(currentRepresentationInfo.fragmentDuration, currentRepresentationInfo.mediaInfo.streamInfo.manifestInfo.DVRWindowSize);
const startTime = liveEdge - liveDelay;
logger.debug('live edge: ' + liveEdge + ', live delay: ' + liveDelay + ', live target: ' + startTime);
const request = getFragmentRequest(currentRepresentationInfo, startTime, {
ignoreIsFinished: true
});
Expand Down
5 changes: 5 additions & 0 deletions src/streaming/controllers/PlaybackController.js
Expand Up @@ -210,6 +210,11 @@ function PlaybackController() {
}

function setLiveStartTime(value) {
if (liveStartTime !== streamInfo.start) {
// Consider only 1st live start time (set by video stream or audio if audio only)
return;
}
logger.info('Set live start time: ' + value);
liveStartTime = value;
}

Expand Down