Browse Source

always delay after output

Gil Pedersen 13 years ago
parent
commit
2e6c709604
1 changed files with 1 additions and 5 deletions
  1. 1 5
      lib/tssmooth.js

+ 1 - 5
lib/tssmooth.js

@@ -118,11 +118,7 @@ function outputBefore(stream, buffer, endTime, packetSize, cb) {
     stream.push(buffer.slice(index, Math.min(buffer.length, index+packetSize)));
     index += packetSize;
 
-    if (index < buffer.length) {
-      //debug('packetTime', (packetTime/1000).toFixed(2));
-      return setTimeout(outputPacket, Math.min(Math.max(0.95*packetTime/1000, 1), 50));
-    }
-    cb();
+    setTimeout((index < buffer.length) ? outputPacket: cb, Math.min(Math.max(0.95*packetTime/1000, 1), 50));
   }
   outputPacket();
 }