fix econnreset in playRawStream (#427)

This commit is contained in:
Brian Tanner
2016-06-14 00:20:26 -04:00
committed by abal
parent 644061e881
commit 4e8ac47f27
2 changed files with 12 additions and 2 deletions

View File

@@ -89,7 +89,14 @@ var AudioEncoder = (function () {
var enc = _child_process2["default"].spawn(_this.getCommand(), ['-i', '-', '-f', 's16le', '-ar', '48000', '-ss', options.seek || 0, '-ac', 2, 'pipe:1']);
stream.pipe(enc.stdin);
var dest = stream.pipe(enc.stdin);
dest.on('unpipe', function () {
return dest.destroy();
});
dest.on('error', function (err) {
return dest.destroy();
});
_this.hookEncodingProcess(resolve, reject, enc, stream);
});

View File

@@ -71,7 +71,10 @@ export default class AudioEncoder {
'pipe:1'
]);
stream.pipe(enc.stdin);
var dest = stream.pipe(enc.stdin);
dest.on('unpipe', () => dest.destroy());
dest.on('error', err => dest.destroy());
this.hookEncodingProcess(resolve, reject, enc, stream);
});