mirror of
https://github.com/danbulant/discord.js
synced 2026-07-05 03:00:35 +00:00
fix econnreset in playRawStream (#427)
This commit is contained in:
parent
644061e881
commit
4e8ac47f27
2 changed files with 12 additions and 2 deletions
|
|
@ -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']);
|
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);
|
_this.hookEncodingProcess(resolve, reject, enc, stream);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,10 @@ export default class AudioEncoder {
|
||||||
'pipe:1'
|
'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);
|
this.hookEncodingProcess(resolve, reject, enc, stream);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue