Skip to content

Commit

Permalink
demo page: bench average level parsing duration
Browse files Browse the repository at this point in the history
  • Loading branch information
mangui committed Dec 19, 2016
1 parent 1628338 commit 90ad50e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ <h4> Stats Display </h4>
});
hls.on(Hls.Events.MANIFEST_PARSED,function(event,data) {
$("#HlsStatus").text("manifest successfully loaded," + hls.levels.length + " levels found");
stats = {levelNb: data.levels.length};
stats = {levelNb: data.levels.length, levelParsed : 0};
updateLevelInfo();
});
hls.on(Hls.Events.AUDIO_TRACKS_UPDATED,function(event,data) {
Expand All @@ -340,6 +340,14 @@ <h4> Stats Display </h4>
parsing : data.stats.tparsed - data.stats.tload,
duration : data.stats.tload - data.stats.tfirst
};
const parsingDuration = data.stats.tparsed - data.stats.tload;
if (stats.levelParsed) {
this.sumLevelParsingMs += parsingDuration;
} else {
this.sumLevelParsingMs = parsingDuration;
}
stats.levelParsed++;
stats.levelParsingUs = Math.round(1000*this.sumLevelParsingMs / stats.levelParsed);
events.load.push(event);
refreshCanvas();
});
Expand Down

0 comments on commit 90ad50e

Please sign in to comment.