Skip to content

Commit

Permalink
Cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
phoboslab committed Nov 21, 2013
1 parent 51523e7 commit 3dbbcb9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions jsmpg.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,17 +405,19 @@ jsmpeg.prototype.scheduleNextFrame = function() {
var wait = Math.max(0, (1000/this.pictureRate) - this.lateTime);
this.targetTime = Date.now() + wait;

if(this.benchmark) {
if( this.benchmark ) {
var now = Date.now();
if(!this.benchframe) {
this.benchstart = now;
this.benchframe = 0;
}
this.benchframe++;
var timepassed = now - this.benchstart;
if(this.benchframe >= 100) {
if( this.benchframe >= 100 ) {
this.benchfps = (this.benchframe / timepassed) * 1000;
if(console) console.log("frames per second: " + this.benchfps);
if( console ) {
console.log("frames per second: " + this.benchfps);
}
this.benchframe = null;
}
setTimeout( this.nextFrame.bind(this), 0);
Expand Down

0 comments on commit 3dbbcb9

Please sign in to comment.