|
|
@@ -54,6 +54,7 @@ function TsSmooth(options) {
|
|
|
this.pcr = -1;
|
|
|
this.last = null;
|
|
|
|
|
|
+ this.error_limit = 80000; /* 80 ms */
|
|
|
this.bitrate = 10E06;
|
|
|
this.pcrtime = -1;
|
|
|
|
|
|
@@ -175,7 +176,7 @@ TsSmooth.prototype._transform = function(chunk, encoding, cb) {
|
|
|
|
|
|
var now = utime();
|
|
|
var error = (out.time - now) - out.delta;
|
|
|
- var waittime = (error > 80000) ? (error/1000 - 5) : 0;
|
|
|
+ var waittime = (error > self.error_limit) ? (error/1000 - 5) : 0;
|
|
|
|
|
|
if (error < -2*1E6 || error > 300*1E6) {
|
|
|
// negative == buffer too late
|
|
|
@@ -183,6 +184,9 @@ TsSmooth.prototype._transform = function(chunk, encoding, cb) {
|
|
|
self.emit('warning', new RateError('PCR sync offset '+(error/1E6).toFixed(2)+'s error'));
|
|
|
self.reset(pcr);
|
|
|
waittime = 0;
|
|
|
+ } else if (error < -self.error_limit) {
|
|
|
+ // ignore the data since it is too late
|
|
|
+ return processNext();
|
|
|
}
|
|
|
|
|
|
return wait(waittime, function output() {
|