Fix loop and only emit error, not warn

This commit is contained in:
Amish Shah
2017-11-04 15:02:58 +00:00
parent 6a523ba96a
commit 2531065bbd

View File

@@ -74,11 +74,11 @@ class StreamDispatcher extends Writable {
* Emitted when the dispatcher encounters an error.
* @event StreamDispatcher#error
*/
this.emit(this.listenerCount('error') > 0 ? 'error' : 'warn', err);
if (err) this.emit('error', err);
this.destroy();
};
this.on('error', streamError);
this.on('error', () => streamError());
if (this.streams.input) this.streams.input.on('error', streamError);
if (this.streams.ffmpeg) this.streams.ffmpeg.on('error', streamError);
if (this.streams.opus) this.streams.opus.on('error', streamError);