update form
This commit is contained in:
parent
077f440dcc
commit
14519607f4
29 changed files with 306 additions and 188 deletions
|
@ -30,7 +30,9 @@ class AbrController extends EventHandler {
|
|||
}
|
||||
|
||||
onFragLoading(data) {
|
||||
this.timer = setInterval(this.onCheck, 100);
|
||||
if (!this.timer) {
|
||||
this.timer = setInterval(this.onCheck, 100);
|
||||
}
|
||||
this.fragCurrent = data.frag;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ class LevelController extends EventHandler {
|
|||
|
||||
destroy() {
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
}
|
||||
this._manualLevel = -1;
|
||||
}
|
||||
|
|
|
@ -208,6 +208,20 @@ class StreamController extends EventHandler {
|
|||
logger.log(`buffer end: ${bufferEnd} is located too far from the end of live sliding playlist, media position will be reseted to: ${this.seekAfterBuffered.toFixed(3)}`);
|
||||
bufferEnd = this.seekAfterBuffered;
|
||||
}
|
||||
|
||||
// if end of buffer greater than live edge, don't load any fragment
|
||||
// this could happen if live playlist intermittently slides in the past.
|
||||
// level 1 loaded [182580161,182580167]
|
||||
// level 1 loaded [182580162,182580169]
|
||||
// Loading 182580168 of [182580162 ,182580169],level 1 ..
|
||||
// Loading 182580169 of [182580162 ,182580169],level 1 ..
|
||||
// level 1 loaded [182580162,182580168] <============= here we should have bufferEnd > end. in that case break to avoid reloading 182580168
|
||||
// level 1 loaded [182580164,182580171]
|
||||
//
|
||||
if (bufferEnd > end) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.startFragRequested && !levelDetails.PTSKnown) {
|
||||
/* we are switching level on live playlist, but we don't have any PTS info for that quality level ...
|
||||
try to load frag matching with next SN.
|
||||
|
@ -1004,11 +1018,11 @@ _checkBuffer() {
|
|||
logger.log(`playback not stuck anymore @${currentTime}`);
|
||||
}
|
||||
// check buffer upfront
|
||||
// if less than 200ms is buffered, and media is expected to play but playhead is not moving,
|
||||
// if less than jumpThreshold second is buffered, and media is expected to play but playhead is not moving,
|
||||
// and we have a new buffer range available upfront, let's seek to that one
|
||||
if(bufferInfo.len <= jumpThreshold) {
|
||||
if(playheadMoving || !expectedPlaying) {
|
||||
// playhead moving or media not playing
|
||||
if(expectedPlaying && bufferInfo.len <= jumpThreshold) {
|
||||
if(playheadMoving) {
|
||||
// playhead moving
|
||||
jumpThreshold = 0;
|
||||
this.seekHoleNudgeDuration = 0;
|
||||
} else {
|
||||
|
|
|
@ -45,5 +45,7 @@ export const ErrorDetails = {
|
|||
// Identifier for a buffer full event
|
||||
BUFFER_FULL_ERROR: 'bufferFullError',
|
||||
// Identifier for a buffer seek over hole event
|
||||
BUFFER_SEEK_OVER_HOLE: 'bufferSeekOverHole'
|
||||
BUFFER_SEEK_OVER_HOLE: 'bufferSeekOverHole',
|
||||
// Identifier for an internal exception happening inside hls.js while handling an event
|
||||
INTERNAL_EXCEPTION: 'internalException'
|
||||
};
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
//import {logger} from './utils/logger';
|
||||
import {logger} from './utils/logger';
|
||||
import {ErrorTypes, ErrorDetails} from './errors';
|
||||
|
||||
class EventHandler {
|
||||
|
||||
|
@ -59,8 +60,13 @@ class EventHandler {
|
|||
}
|
||||
return this[funcName].bind(this, data);
|
||||
};
|
||||
eventToFunction.call(this, event, data).call();
|
||||
try {
|
||||
eventToFunction.call(this, event, data).call();
|
||||
} catch (err) {
|
||||
logger.error(`internal error happened while processing ${event}:${err.message}`);
|
||||
this.hls.trigger(Event.ERROR, {type: ErrorTypes.OTHER_ERROR, details: ErrorDetails.INTERNAL_EXCEPTION, fatal: false, event : event, err : err});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default EventHandler;
|
||||
export default EventHandler;
|
||||
|
|
|
@ -44,10 +44,14 @@ class LevelHelper {
|
|||
if(PTSFrag) {
|
||||
LevelHelper.updateFragPTS(newDetails,PTSFrag.sn,PTSFrag.startPTS,PTSFrag.endPTS);
|
||||
} else {
|
||||
// adjust start by sliding offset
|
||||
var sliding = oldfragments[delta].start;
|
||||
for(i = 0 ; i < newfragments.length ; i++) {
|
||||
newfragments[i].start += sliding;
|
||||
// ensure that delta is within oldfragments range
|
||||
// no need to offset start if delta === 0
|
||||
if (delta > 0 && delta < oldfragments.length) {
|
||||
// adjust start by sliding offset
|
||||
var sliding = oldfragments[delta].start;
|
||||
for(i = 0 ; i < newfragments.length ; i++) {
|
||||
newfragments[i].start += sliding;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if we are here, it means we have fragments overlapping between
|
||||
|
|
|
@ -142,6 +142,7 @@ class Hls {
|
|||
this.playlistLoader.destroy();
|
||||
this.fragmentLoader.destroy();
|
||||
this.levelController.destroy();
|
||||
this.abrController.destroy();
|
||||
this.bufferController.destroy();
|
||||
this.capLevelController.destroy();
|
||||
this.streamController.destroy();
|
||||
|
|
|
@ -190,8 +190,8 @@ class MP4Remuxer {
|
|||
ptsnorm = this._PTSNormalize(pts, nextAvcDts);
|
||||
dtsnorm = this._PTSNormalize(dts, nextAvcDts);
|
||||
delta = Math.round((dtsnorm - nextAvcDts) / 90);
|
||||
// if fragment are contiguous, or delta less than 600ms, ensure there is no overlap/hole between fragments
|
||||
if (contiguous || Math.abs(delta) < 600) {
|
||||
// if fragment are contiguous, or if there is a huge delta (more than 10s) between expected PTS and sample PTS
|
||||
if (contiguous || Math.abs(delta) > 10000) {
|
||||
if (delta) {
|
||||
if (delta > 1) {
|
||||
logger.log(`AVC:${delta} ms hole between fragments detected,filling it`);
|
||||
|
@ -314,8 +314,8 @@ class MP4Remuxer {
|
|||
ptsnorm = this._PTSNormalize(pts, nextAacPts);
|
||||
dtsnorm = this._PTSNormalize(dts, nextAacPts);
|
||||
delta = Math.round(1000 * (ptsnorm - nextAacPts) / pesTimeScale);
|
||||
// if fragment are contiguous, or delta less than 600ms, ensure there is no overlap/hole between fragments
|
||||
if (contiguous || Math.abs(delta) < 600) {
|
||||
// if fragment are contiguous, or if there is a huge delta (more than 10s) between expected PTS and sample PTS
|
||||
if (contiguous || Math.abs(delta) > 10000) {
|
||||
// log delta
|
||||
if (delta) {
|
||||
if (delta > 0) {
|
||||
|
@ -327,7 +327,7 @@ class MP4Remuxer {
|
|||
track.len -= unit.byteLength;
|
||||
continue;
|
||||
}
|
||||
// set DTS to next DTS
|
||||
// set PTS/DTS to next PTS/DTS
|
||||
ptsnorm = dtsnorm = nextAacPts;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue