Skip to content

Commit

Permalink
Diagnostics - fix drift info (#264)
Browse files Browse the repository at this point in the history
* Diagnostics - fix drift info

* Diagnostics - fix drift info - update

* Diagnostics - fix drift info - update

* Diagnostics - fix drift info - update
  • Loading branch information
gadyaari authored Sep 28, 2016
1 parent 664eb87 commit e5b0756
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion common/config/config.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"diagnostics": {
"minChunkDurationInSec": 1,
"maxChunkDurationInSec": 60,
"errorsWindowSizeInMin" : 60,
"errorsWindowSizeInMin" : 5,
"ptsMaxMisalignmentAllowedInMSec" : 5000
},
"simulateStreams": {
Expand Down
11 changes: 7 additions & 4 deletions lib/entry/FlavorDownloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@ var FlavorDownloader = (function() {
delete that.chunksToDownload[chunkName];
let alertObj = new diagnosticsAlerts.TsConversionFailureAlert(that.flavor, err.message, err.chunkName);
that.emit('diagnosticsAlert', alertObj);

return Q.resolve(null);
}
else {
that.logger.error("Error in MP4 conversion: %s", ErrorUtils.error2string(err));
}
return Q.resolve(null);
});
}))
.then(function(results) {
Expand Down Expand Up @@ -302,7 +304,7 @@ var FlavorDownloader = (function() {
if (results.newMp4Files.length > 0) {
that.logger.info("Finished downloading new files, raising 'newStreamFiles' event");
var duration = _.reduce(results.newMp4Files, function(memo, mp4) {
return memo + mp4.video ? mp4.video.duration : mp4.audio.duration;
return (mp4.video) ? memo + mp4.video.duration : memo + mp4.audio.duration;
}, 0);
// Raise event and send the new files' duration in Seconds
that.emit('newStreamFiles', that, duration / 1000);
Expand Down Expand Up @@ -378,7 +380,8 @@ var FlavorDownloader = (function() {
this.mediaInfo.bitrate_kbps = mp4Data.metaData.bitrate_kbps;
this.mediaInfo.framesPerSecond = mp4Data.metaData.framerate;
this.mediaInfo.lastChunkName = mp4Data.chunkName;
this.mediaInfo.keyFramesDistance = mp4Data.metaData.keyFramesDistance;
this.mediaInfo.keyFramesDistance = mp4Data.metaData.keyFrameDistance;
this.mediaInfo.drift = this.playlistGenerator.driftInfo[this.flavor];
}

FlavorDownloader.prototype.stop = function() {
Expand Down
4 changes: 2 additions & 2 deletions lib/playlistGenerator/ConcatSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ ConcatSource.prototype.checkDiscontinuity = function (fileInfo,track) {
diagDrift['deltaClock'] = track.firstEncoderDTS - that.inner.refEncoderDTS;
diagDrift['refPts'] = that.inner.refPTS;
diagDrift['refEncoderDts'] = that.inner.refEncoderDTS;

that.emit(playlistUtils.ClipEvents.diagnosticsInfo, that, diagDrift);
that.emit(playlistUtils.ClipEvents.diagnosticsInfo, that, fileInfo.flavor, diagDrift);

checkOverlap.call(that,firstDTS,lastDTS);

Expand Down
5 changes: 2 additions & 3 deletions lib/playlistGenerator/PlaylistGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function PlaylistGenerator (entryObject) {
that.gapsCounter = 0;
that.reorderCounter = 0;

that.driftInfo = {};
that.driftInfo = {}
}

util.inherits(PlaylistGenerator,EventEmitter);
Expand Down Expand Up @@ -407,7 +407,7 @@ PlaylistGenerator.prototype.handleEvent = function (type,arg) {
that.isDirty = true;
break;
case playlistUtils.ClipEvents.diagnosticsInfo:
that.driftInfo = arguments[2];
that.driftInfo[arguments[2]] = arguments[3];
break;
case playlistUtils.ClipEvents.diagnosticsAlert:
that.emit('diagnosticsAlert', arguments[2]);
Expand All @@ -422,7 +422,6 @@ PlaylistGenerator.prototype.toJSON = function () {
diag.playlistPath = that.playlistPath;
diag.gapsCounter = that.gapsCounter;
diag.config = that.playListLimits;
diag.drift = that.driftInfo;
return diag;
};

Expand Down

0 comments on commit e5b0756

Please sign in to comment.