Skip to content

Commit

Permalink
Restores backticks on log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
cmelendez committed Sep 28, 2015
1 parent 17731f8 commit 26e2bd1
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 76 deletions.
41 changes: 21 additions & 20 deletions src/controller/buffer-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class BufferController {
if (this.levels && this.video) {
this.startInternal();
if (this.lastCurrentTime) {
logger.log('seeking @ ${this.lastCurrentTime}');
logger.log(`seeking @ ${this.lastCurrentTime}`);
this.nextLoadPosition = this.startPosition = this.lastCurrentTime;
if (!this.lastPaused) {
logger.log('resuming video');
Expand Down Expand Up @@ -200,10 +200,10 @@ class BufferController {
let fragments = levelDetails.fragments, frag, sliding = levelDetails.sliding, start = fragments[0].start + sliding, drift = 0;
// check if requested position is within seekable boundaries :
// in case of live playlist we need to ensure that requested position is not located before playlist start
//logger.log('start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${this.video.seeking}');
//logger.log(`start/pos/bufEnd/seeking:${start.toFixed(3)}/${pos.toFixed(3)}/${bufferEnd.toFixed(3)}/${this.video.seeking}`);
if (bufferEnd < start) {
this.seekAfterStalling = this.startPosition + sliding;
logger.log('buffer end: ${bufferEnd} is located before start of live sliding playlist, media position will be reseted to: ${this.seekAfterStalling.toFixed(3)}');
logger.log(`buffer end: ${bufferEnd} is located before start of live sliding playlist, media position will be reseted to: ${this.seekAfterStalling.toFixed(3)}`);
bufferEnd = this.seekAfterStalling;
}
if (levelDetails.live && levelDetails.sliding === undefined) {
Expand All @@ -215,15 +215,15 @@ class BufferController {
var targetSN = this.frag.sn + 1;
if (targetSN >= levelDetails.startSN && targetSN <= levelDetails.endSN) {
frag = fragments[targetSN - levelDetails.startSN];
logger.log('live playlist, switching playlist, load frag with next SN: ${frag.sn}');
logger.log(`live playlist, switching playlist, load frag with next SN: ${frag.sn}`);
}
}
if (!frag) {
/* we have no idea about which fragment should be loaded.
so let's load mid fragment. it will help computing playlist sliding and find the right one
*/
frag = fragments[Math.round(fragments.length / 2)];
logger.log('live playlist, switching playlist, unknown, load middle frag : ${frag.sn}');
logger.log(`live playlist, switching playlist, unknown, load middle frag : ${frag.sn}`);
}
} else {
//look for fragments matching with current play position
Expand Down Expand Up @@ -251,11 +251,11 @@ class BufferController {
break;
} else {
frag = fragments[fragIdx + 1];
logger.log('SN just loaded, load next one: ${frag.sn}');
logger.log(`SN just loaded, load next one: ${frag.sn}`);
}
}
}
logger.log('Loading ${frag.sn} of [${levelDetails.startSN} ,${levelDetails.endSN}],level ${level}, currentTime:${pos},bufferEnd:${bufferEnd.toFixed(3)}');
logger.log(`Loading ${frag.sn} of [${levelDetails.startSN} ,${levelDetails.endSN}],level ${level}, currentTime:${pos},bufferEnd:${bufferEnd.toFixed(3)}`);
//logger.log(' loading frag ' + i +',pos/bufEnd:' + pos.toFixed(3) + '/' + bufferEnd.toFixed(3));
frag.drift = drift;
frag.autoLevel = this.hls.autoLevelEnabled;
Expand Down Expand Up @@ -320,7 +320,7 @@ class BufferController {
if (bufferStarvationDelay < (2 * frag.duration) && fragLoadedDelay > bufferStarvationDelay && fragLoadedDelay > fragLevelNextLoadedDelay) {
// abort fragment loading ...
logger.warn('loading too slow, abort fragment loading');
logger.log('fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay :${fragLoadedDelay.toFixed(1)}/${bufferStarvationDelay.toFixed(1)}/${fragLevelNextLoadedDelay.toFixed(1)}');
logger.log(`fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay :${fragLoadedDelay.toFixed(1)}/${bufferStarvationDelay.toFixed(1)}/${fragLevelNextLoadedDelay.toFixed(1)}`);
//abort fragment loading
frag.loader.abort();
this.frag = null;
Expand Down Expand Up @@ -350,7 +350,7 @@ class BufferController {
this.appendError = 0;
} catch(err) {
// in case any error occured while appending, put back segment in mp4segments table
logger.error('error while trying to append buffer:${err.message},try appending later');
logger.error(`error while trying to append buffer:${err.message},try appending later`);
this.mp4segments.unshift(segment);
if (this.appendError) {
this.appendError++;
Expand All @@ -362,7 +362,7 @@ class BufferController {
browser is able to evict some data from sourcebuffer. retrying help recovering this
*/
if (this.appendError > this.config.appendErrorMaxRetry) {
logger.log('fail ${this.config.appendErrorMaxRetry} times to append segment in sourceBuffer');
logger.log(`fail ${this.config.appendErrorMaxRetry} times to append segment in sourceBuffer`);
event.fatal = true;
observer.trigger(Event.ERROR, event);
this.state = this.ERROR;
Expand Down Expand Up @@ -562,7 +562,7 @@ class BufferController {
only flush buffer range of length greater than 500ms.
*/
if (flushEnd - flushStart > 0.5) {
logger.log('flush ${type} [${flushStart},${flushEnd}], of [${bufStart},${bufEnd}], pos:${this.video.currentTime}');
logger.log(`flush ${type} [${flushStart},${flushEnd}], of [${bufStart},${bufEnd}], pos:${this.video.currentTime}`);
sb.remove(flushStart, flushEnd);
return false;
}
Expand Down Expand Up @@ -769,7 +769,7 @@ class BufferController {
newLevel = this.levels[newLevelId],
curLevel = this.levels[this.level],
sliding = 0;
logger.log('level ${newLevelId} loaded [${newLevelDetails.startSN},${newLevelDetails.endSN}],duration:${duration}');
logger.log(`level ${newLevelId} loaded [${newLevelDetails.startSN},${newLevelDetails.endSN}],duration:${duration}`);
// check if playlist is already loaded (if yes, it should be a live playlist)
if (curLevel && curLevel.details && curLevel.details.live) {
var curLevelDetails = curLevel.details;
Expand All @@ -784,15 +784,15 @@ class BufferController {
if (SNdiff < oldfragments.length) {
sliding = curLevelDetails.sliding + oldfragments[SNdiff].start;
} else {
logger.log('cannot compute sliding, no SN in common between old/new level:[${curLevelDetails.startSN},${curLevelDetails.endSN}]/[${newLevelDetails.startSN},${newLevelDetails.endSN}]');
logger.log(`cannot compute sliding, no SN in common between old/new level:[${curLevelDetails.startSN},${curLevelDetails.endSN}]/[${newLevelDetails.startSN},${newLevelDetails.endSN}]`);
sliding = undefined;
}
} else {
// negative sliding: new playlist sliding window is before previous one
sliding = curLevelDetails.sliding - newLevelDetails.fragments[-SNdiff].start;
}
if (sliding) {
logger.log('live playlist sliding:${sliding.toFixed(3)}');
logger.log(`live playlist sliding:${sliding.toFixed(3)}`);
}
}
// override level info
Expand Down Expand Up @@ -835,7 +835,7 @@ class BufferController {
if (this.frag.drift) {
start += this.frag.drift;
}
logger.log('Demuxing ${this.frag.sn} of [${details.startSN} ,${details.endSN}],level ${this.level}');
logger.log(`Demuxing ${this.frag.sn} of [${details.startSN} ,${details.endSN}],level ${this.level}`);
this.demuxer.push(data.payload, currentLevel.audioCodec, currentLevel.videoCodec, start, this.frag.cc, this.level, duration);
}
}
Expand All @@ -862,7 +862,7 @@ class BufferController {
}
if (!this.sourceBuffer) {
this.sourceBuffer = {};
logger.log('selected A/V codecs for sourceBuffers:${audioCodec},${videoCodec}');
logger.log(`selected A/V codecs for sourceBuffers:${audioCodec},${videoCodec}`);
// create source Buffer and link them to MediaSource
if (audioCodec) {
sb = this.sourceBuffer.audio = this.mediaSource.addSourceBuffer('video/mp4;codecs=${audioCodec}');
Expand Down Expand Up @@ -899,7 +899,7 @@ class BufferController {
//logger.log('live playlist sliding:${level.details.sliding.toFixed(3)}');
}
}
logger.log(' parsed data, type/startPTS/endPTS/startDTS/endDTS/nb:${data.type}/${data.startPTS.toFixed(3)}/${data.endPTS.toFixed(3)}/${data.startDTS.toFixed(3)}/${data.endDTS.toFixed(3)}/${data.nb}');
logger.log(`parsed data, type/startPTS/endPTS/startDTS/endDTS/nb:${data.type}/${data.startPTS.toFixed(3)}/${data.endPTS.toFixed(3)}/${data.startDTS.toFixed(3)}/${data.endDTS.toFixed(3)}/${data.nb}`);
//this.frag.drift=data.startPTS-this.frag.start;
this.frag.drift = 0;
// if(level.details.sliding) {
Expand All @@ -916,7 +916,7 @@ class BufferController {
//trigger handler right now
this.tick();
} else {
logger.warn('not in PARSING state, discarding ${event}');
logger.warn(`not in PARSING state, discarding ${event}`);
}
}

Expand All @@ -938,7 +938,7 @@ class BufferController {
case ErrorDetails.LEVEL_LOAD_ERROR:
case ErrorDetails.LEVEL_LOAD_TIMEOUT:
// if fatal error, stop processing, otherwise move to IDLE to retry loading
logger.warn('buffer controller: ${data.details} while loading frag,switch to ${data.fatal ? "ERROR" : "IDLE"} state ...');
logger.warn(`buffer controller: ${data.details} while loading frag,switch to ${data.fatal ? 'ERROR' : 'IDLE'} state ...`);
this.state = data.fatal ? this.ERROR : this.IDLE;
this.frag = null;
break;
Expand All @@ -960,10 +960,11 @@ class BufferController {
}

onSourceBufferError(event) {
logger.error('sourceBuffer error:${event}');
logger.error(`sourceBuffer error:${event}`);
this.state = this.ERROR;
observer.trigger(Event.ERROR, {type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_APPENDING_ERROR, fatal: true, frag: this.frag});
}
}

export default BufferController;

3 changes: 2 additions & 1 deletion src/controller/fps-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FPSController {
var decodedFPS = 1000 * currentDecoded / currentPeriod;
var droppedFPS = 1000 * currentDropped / currentPeriod;
if (droppedFPS > 0) {
logger.log('checkFPS : droppedFPS/decodedFPS:${droppedFPS.toFixed(1)}/${decodedFPS.toFixed(1)}');
logger.log(`checkFPS : droppedFPS/decodedFPS:${droppedFPS.toFixed(1)}/${decodedFPS.toFixed(1)}`);
if (currentDropped > this.hls.config.fpsDroppedMonitoringThreshold * currentDecoded) {
logger.warn('drop FPS ratio greater than max allowed value');
observer.trigger(Event.FPS_DROP, {currentDropped: currentDropped, currentDecoded: currentDecoded, totalDroppedFrames: droppedFrames});
Expand All @@ -47,3 +47,4 @@ class FPSController {
}

export default FPSController;

13 changes: 7 additions & 6 deletions src/controller/level-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class LevelController {
for (i = 0; i < levels.length; i++) {
if (levels[i].bitrate === bitrateStart) {
this._firstLevel = i;
logger.log('manifest loaded,${levels.length} level(s) found, first bitrate:${bitrateStart}');
logger.log(`manifest loaded,${levels.length} level(s) found, first bitrate:${bitrateStart}`);
break;
}
}
Expand Down Expand Up @@ -89,13 +89,13 @@ class LevelController {
this.timer = null;
}
this._level = newLevel;
logger.log('switching to level ${newLevel}');
logger.log(`switching to level ${newLevel}`);
observer.trigger(Event.LEVEL_SWITCH, {level: newLevel});
var level = this._levels[newLevel];
// check if we need to load playlist for this level
if (level.details === undefined || level.details.live === true) {
// level not retrieved yet, or live playlist we need to (re)load it
logger.log('(re)loading playlist for level ${newLevel}');
logger.log(`(re)loading playlist for level ${newLevel}`);
var urlId = level.urlId;
observer.trigger(Event.LEVEL_LOADING, {url: level.url[urlId], level: newLevel, id: urlId});
}
Expand Down Expand Up @@ -181,16 +181,16 @@ class LevelController {
if (level.urlId < (level.url.length - 1)) {
level.urlId++;
level.details = undefined;
logger.warn('level controller,${details} for level ${levelId}: switching to redundant stream id ${level.urlId}');
logger.warn(`level controller,${details} for level ${levelId}: switching to redundant stream id ${level.urlId}`);
} else {
// we could try to recover if in auto mode and current level not lowest level (0)
let recoverable = ((this._manualLevel === -1) && levelId);
if (recoverable) {
logger.warn('level controller,${details}: emergency switch-down for next fragment');
logger.warn(`level controller,${details}: emergency switch-down for next fragment`);
this.lastbw = 0;
this.lastfetchduration = 0;
} else {
logger.error('cannot recover ${details} error');
logger.error(`cannot recover ${details} error`);
this._level = undefined;
// stopping live reloading timer if any
if (this.timer) {
Expand Down Expand Up @@ -258,3 +258,4 @@ class LevelController {
}

export default LevelController;

1 change: 1 addition & 0 deletions src/demux/demuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ class Demuxer {
}

export default Demuxer;

19 changes: 10 additions & 9 deletions src/demux/tsdemuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
this.lastCC = 0;
this.PES_TIMESCALE = 90000;
this.PES2MP4SCALEFACTOR = 4;
this.MP4_TIMESCALE = this.PES_TIMESCALE/this.PES2MP4SCALEFACTOR;
this.MP4_TIMESCALE = this.PES_TIMESCALE / this.PES2MP4SCALEFACTOR;
}

switchLevel() {
Expand All @@ -41,7 +41,7 @@

// feed incoming data to the front of the parsing pipeline
push(data, audioCodec, videoCodec, timeOffset, cc, level, duration) {
var avcData,aacData,start,len = data.length,stt,pid,atf,offset;
var avcData, aacData, start, len = data.length, stt, pid, atf, offset;
this.audioCodec = audioCodec;
this.videoCodec = videoCodec;
this.timeOffset = timeOffset;
Expand Down Expand Up @@ -352,9 +352,9 @@
if (absdelta < 300) {
//logger.log('Video next PTS:' + this.nextAvcPts);
if (delta > 1) {
logger.log('AVC:${delta} ms hole between fragments detected,filling it');
logger.log(`AVC:${delta} ms hole between fragments detected,filling it`);
} else if (delta < -1) {
logger.log('AVC:${(-delta)} ms overlapping between fragments detected');
logger.log(`AVC:${(-delta)} ms overlapping between fragments detected`);
}
// set PTS to next PTS
ptsnorm = this.nextAvcPts;
Expand Down Expand Up @@ -541,7 +541,7 @@
if (adtsStartOffset) {
var reason, fatal;
if (adtsStartOffset < len - 1) {
reason = 'AAC PES did not start with ADTS header,offset:${adtsStartOffset}';
reason = `AAC PES did not start with ADTS header,offset:${adtsStartOffset}`;
fatal = false;
} else {
reason = 'no ADTS header found in AAC PES';
Expand All @@ -560,7 +560,7 @@
track.codec = config.codec;
track.timescale = this.MP4_TIMESCALE;
track.duration = this.MP4_TIMESCALE * this._duration;
logger.log('parsed codec:${track.codec},rate:${config.samplerate},nb channel:${config.channelCount}');
logger.log(`parsed codec:${track.codec},rate:${config.samplerate},nb channel:${config.channelCount}`);
}
nbSamples = 0;
while ((adtsStartOffset + 5) < len) {
Expand Down Expand Up @@ -627,13 +627,13 @@
// if delta is less than 300 ms, next loaded fragment is assumed to be contiguous with last one
if (absdelta > 1 && absdelta < 300) {
if (delta > 0) {
logger.log('AAC:${delta} ms hole between fragments detected,filling it');
logger.log(`AAC:${delta} ms hole between fragments detected,filling it`);
// set PTS to next PTS, and ensure PTS is greater or equal than last DTS
ptsnorm = Math.max(this.nextAacPts, this.lastAacDts);
dtsnorm = ptsnorm;
//logger.log('Audio/PTS/DTS adjusted:' + aacSample.pts + '/' + aacSample.dts);
} else {
logger.log('AAC:${(-delta)} ms overlapping between fragments detected');
logger.log(`AAC:${(-delta)} ms overlapping between fragments detected`);
}
}
else if (absdelta) {
Expand Down Expand Up @@ -717,7 +717,7 @@
adtsChanelConfig = ((data[offset + 2] & 0x01) << 2);
// byte 3
adtsChanelConfig |= ((data[offset + 3] & 0xC0) >>> 6);
logger.log('manifest codec:${audioCodec},ADTS data:type:${adtsObjectType},sampleingIndex:${adtsSampleingIndex}[${adtsSampleingRates[adtsSampleingIndex]}kHz],channelConfig:${adtsChanelConfig}');
logger.log(`manifest codec:${audioCodec},ADTS data:type:${adtsObjectType},sampleingIndex:${adtsSampleingIndex}[${adtsSampleingRates[adtsSampleingIndex]}kHz],channelConfig:${adtsChanelConfig}`);
// firefox: freq less than 24kHz = AAC SBR (HE-AAC)
if (userAgent.indexOf('firefox') !== -1) {
if (adtsSampleingIndex >= 6) {
Expand Down Expand Up @@ -867,3 +867,4 @@
}

export default TSDemuxer;

1 change: 1 addition & 0 deletions src/demux/tsdemuxerworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ var TSDemuxerWorker = function (self) {
};

export default TSDemuxerWorker;

14 changes: 7 additions & 7 deletions src/hls.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class Hls {
}

loadSource(url) {
logger.log('loadSource:${url}');
logger.log(`loadSource:${url}`);
this.url = url;
// when attaching to a source URL, trigger a playlist load
observer.trigger(Event.MANIFEST_LOADING, {url: url});
Expand Down Expand Up @@ -156,7 +156,7 @@ class Hls {

/* set quality level immediately (-1 for automatic level selection) */
set currentLevel(newLevel) {
logger.log('set currentLevel:${newLevel}');
logger.log(`set currentLevel:${newLevel}`);
this.loadLevel = newLevel;
this.bufferController.immediateLevelSwitch();
}
Expand All @@ -168,7 +168,7 @@ class Hls {

/* set quality level for next fragment (-1 for automatic level selection) */
set nextLevel(newLevel) {
logger.log('set nextLevel:${newLevel}');
logger.log(`set nextLevel:${newLevel}`);
this.levelController.manualLevel = newLevel;
this.bufferController.nextLevelSwitch();
}
Expand All @@ -180,7 +180,7 @@ class Hls {

/* set quality level for current/next loaded fragment (-1 for automatic level selection) */
set loadLevel(newLevel) {
logger.log('set loadLevel:${newLevel}');
logger.log(`set loadLevel:${newLevel}`);
this.levelController.manualLevel = newLevel;
}

Expand All @@ -203,7 +203,7 @@ class Hls {
/** set first level (index of first level referenced in manifest)
**/
set firstLevel(newLevel) {
logger.log('set firstLevel:${newLevel}');
logger.log(`set firstLevel:${newLevel}`);
this.levelController.firstLevel = newLevel;
}

Expand All @@ -220,7 +220,7 @@ class Hls {
if -1 : automatic start level selection, playback will start from level matching download bandwidth (determined from download of first segment)
**/
set startLevel(newLevel) {
logger.log('set startLevel:${newLevel}');
logger.log(`set startLevel:${newLevel}`);
this.levelController.startLevel = newLevel;
}

Expand All @@ -231,7 +231,7 @@ class Hls {

/** set the capping/max level value that could be used by automatic level selection algorithm **/
set autoLevelCapping(newLevel) {
logger.log('set autoLevelCapping:${newLevel}');
logger.log(`set autoLevelCapping:${newLevel}`);
this.levelController.autoLevelCapping = newLevel;
}

Expand Down
Loading

0 comments on commit 26e2bd1

Please sign in to comment.