mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 02:53:31 +01:00
fix econnreset in playRawStream (#427)
This commit is contained in:
@@ -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);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user