Skip to content

Commit

Permalink
Optimize live start (#3283)
Browse files Browse the repository at this point in the history
* Optimize live start: consider seek target according to video stream timeline

* Optimize live start: consider seek target according to video stream timeline
  • Loading branch information
Bertrand Berthelot committed Jun 10, 2020
1 parent 15d87a9 commit 3f0b7ef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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);

This comment has been minimized.

Copy link
@AUGxhub

AUGxhub Jun 12, 2020

format here ??

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

0 comments on commit 3f0b7ef

Please sign in to comment.