Merge pull request #2 from notthetup/master

Stop trying to read if no inputs are connected
This commit is contained in:
Xéfir Destiny 2016-08-07 08:46:42 +02:00 committed by GitHub
commit d98126947b

View File

@ -73,7 +73,9 @@ Mixer.prototype._read = function() {
this.push(mixedBuffer);
} else {
setImmediate(this._read.bind(this));
if (this.inputs.length){
setImmediate(this._read.bind(this));
}
}
};
@ -91,6 +93,10 @@ Mixer.prototype.input = function (args) {
input.on('finish', () =>{
this.inputs.splice(this.inputs.indexOf(input), 1);
});
if (this.inputs.length === 1){
setImmediate(this._read.bind(this));
}
return input;
};