Fix #69 (nice?) Hopefully for good this time. It was already very difficult to create an infinite cache loop. Now even if the worst happens, it might repeat the last few seconds of a video once but nothing more.
This commit is contained in:
parent
c4514b3255
commit
43bf85db20
@ -31,10 +31,21 @@ function getCurrentLineupItem(channelId, t1) {
|
||||
let recorded = cache[channelId];
|
||||
let lineupItem = JSON.parse( JSON.stringify(recorded.lineupItem) );
|
||||
let diff = t1 - recorded.t0;
|
||||
if ( (diff <= SLACK) && (lineupItem.duration >= 2*SLACK) ) {
|
||||
let rem = lineupItem.duration - lineupItem.start;
|
||||
if (typeof(lineupItem.streamDuration) !== 'undefined') {
|
||||
rem = Math.min(rem, lineupItem.streamDuration);
|
||||
}
|
||||
if ( (diff <= SLACK) && (diff + SLACK < rem) ) {
|
||||
//closed the stream and opened it again let's not lose seconds for
|
||||
//no reason
|
||||
return lineupItem;
|
||||
let originalT0 = recorded.lineupItem.originalT0;
|
||||
if (typeof(originalT0) === 'undefined') {
|
||||
originalT0 = recorded.t0;
|
||||
}
|
||||
if (t1 - originalT0 <= SLACK) {
|
||||
lineupItem.originalT0 = originalT0;
|
||||
return lineupItem;
|
||||
}
|
||||
}
|
||||
|
||||
lineupItem.start += diff;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user