Fixed multiple avconvs/ffmpeg processes still staying alive

This commit is contained in:
Amish Shah
2015-12-12 21:04:30 +00:00
parent 4d43867206
commit c2cf1badfd
2 changed files with 8 additions and 4 deletions

View File

@@ -92,6 +92,8 @@ var VoiceConnection = (function (_EventEmitter) {
this.playing = false; this.playing = false;
this.playingIntent = null; this.playingIntent = null;
if (this.streamProc) { if (this.streamProc) {
this.streamProc.stdin.pause();
this.streamProc.kill("SIGINT");
this.streamProc.kill(); this.streamProc.kill();
} }
if (this.instream) { if (this.instream) {
@@ -129,7 +131,7 @@ var VoiceConnection = (function (_EventEmitter) {
if (!self.playingIntent || !self.playing) { if (!self.playingIntent || !self.playing) {
self.setSpeaking(false); self.setSpeaking(false);
retStream.emit("end"); retStream.emit("end");
console.log("ending 1"); //console.log("ending 1");
return; return;
} }
try { try {
@@ -140,7 +142,7 @@ var VoiceConnection = (function (_EventEmitter) {
if (onWarning) { if (onWarning) {
retStream.emit("end"); retStream.emit("end");
self.setSpeaking(false); self.setSpeaking(false);
console.log("ending 2"); //console.log("ending 2");
return; return;
} else { } else {
onWarning = true; onWarning = true;

View File

@@ -63,6 +63,8 @@ export default class VoiceConnection extends EventEmitter {
this.playing = false; this.playing = false;
this.playingIntent = null; this.playingIntent = null;
if (this.streamProc) { if (this.streamProc) {
this.streamProc.stdin.pause();
this.streamProc.kill("SIGINT");
this.streamProc.kill(); this.streamProc.kill();
} }
if(this.instream){ if(this.instream){
@@ -99,7 +101,7 @@ export default class VoiceConnection extends EventEmitter {
if (!self.playingIntent || !self.playing) { if (!self.playingIntent || !self.playing) {
self.setSpeaking(false); self.setSpeaking(false);
retStream.emit("end"); retStream.emit("end");
console.log("ending 1"); //console.log("ending 1");
return; return;
} }
try { try {
@@ -110,7 +112,7 @@ export default class VoiceConnection extends EventEmitter {
if (onWarning) { if (onWarning) {
retStream.emit("end"); retStream.emit("end");
self.setSpeaking(false); self.setSpeaking(false);
console.log("ending 2"); //console.log("ending 2");
return; return;
} else { } else {
onWarning = true; onWarning = true;