mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
@@ -122,17 +122,17 @@ var AudioEncoder = (function () {
|
||||
};
|
||||
|
||||
AudioEncoder.prototype.hookEncodingProcess = function hookEncodingProcess(resolve, reject, enc, stream) {
|
||||
var _this4 = this;
|
||||
|
||||
var processKilled = false;
|
||||
|
||||
function killProcess() {
|
||||
function killProcess(cause) {
|
||||
if (processKilled) return;
|
||||
|
||||
enc.stdin.pause();
|
||||
enc.kill("SIGINT");
|
||||
enc.kill("SIGKILL");
|
||||
|
||||
processKilled = true;
|
||||
|
||||
reject(cause);
|
||||
}
|
||||
|
||||
var ffmpegErrors = "";
|
||||
@@ -143,10 +143,12 @@ var AudioEncoder = (function () {
|
||||
ffmpegErrors += "\n" + new Buffer(data).toString().trim();
|
||||
});
|
||||
|
||||
enc.stdout.on("end", function () {
|
||||
killProcess();
|
||||
enc.stdout.once("end", function () {
|
||||
killProcess("end");
|
||||
});
|
||||
|
||||
reject("end");
|
||||
enc.stdout.once("error", function () {
|
||||
enc.stdout.emit("end");
|
||||
});
|
||||
|
||||
enc.once("exit", function (code, signal) {
|
||||
@@ -170,21 +172,19 @@ var AudioEncoder = (function () {
|
||||
});
|
||||
|
||||
this.volume.once("end", function () {
|
||||
killProcess();
|
||||
killProcess("end");
|
||||
});
|
||||
|
||||
reject("end");
|
||||
this.volume.once("error", function () {
|
||||
killProcess("end");
|
||||
});
|
||||
|
||||
this.volume.on("end", function () {
|
||||
killProcess();
|
||||
|
||||
reject("end");
|
||||
killProcess("end");
|
||||
});
|
||||
|
||||
this.volume.on("close", function () {
|
||||
killProcess();
|
||||
|
||||
reject("close");
|
||||
killProcess("close");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ var VoiceConnection = (function (_EventEmitter) {
|
||||
}
|
||||
if (this.streamProc) {
|
||||
this.streamProc.stdin.pause();
|
||||
this.streamProc.kill("SIGINT");
|
||||
this.streamProc.kill("SIGKILL");
|
||||
this.streamProc = null;
|
||||
}
|
||||
};
|
||||
@@ -156,6 +156,7 @@ var VoiceConnection = (function (_EventEmitter) {
|
||||
}
|
||||
if (!self.playingIntent || !self.playing) {
|
||||
self.setSpeaking(false);
|
||||
self.stopPlaying();
|
||||
retStream.emit("end");
|
||||
return;
|
||||
}
|
||||
@@ -166,6 +167,7 @@ var VoiceConnection = (function (_EventEmitter) {
|
||||
if (!buffer) {
|
||||
if (onWarning) {
|
||||
self.setSpeaking(false);
|
||||
self.stopPlaying();
|
||||
retStream.emit("end");
|
||||
return;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user