You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 22:13:53 +01:00
Merge pull request #170 from AmateurAudioDude/fixes/v1.3.10-fix-listener-error
Prevent listener stacking on error
This commit is contained in:
@@ -237,6 +237,17 @@ checkFFmpeg().then((ffmpegPath) => {
|
||||
commandDef.args.splice(commandDef.recArgs.indexOf('pipe:1'), 0, '-af', 'volume=1.7');
|
||||
}
|
||||
|
||||
let currentRec = null;
|
||||
|
||||
process.on('exit', () => {
|
||||
if (currentRec) currentRec.kill('SIGINT');
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
if (currentRec) currentRec.kill('SIGINT');
|
||||
process.exit();
|
||||
});
|
||||
|
||||
function startRec() {
|
||||
if (!serverConfig.audio.ffmpeg) {
|
||||
// Spawn rec
|
||||
@@ -244,6 +255,7 @@ checkFFmpeg().then((ffmpegPath) => {
|
||||
|
||||
//const rec = spawn(commandDef.command, { shell: true, stdio: ['ignore', 'pipe', 'pipe'] });
|
||||
const rec = spawn('rec', commandDef.recArgs, { stdio: ['ignore', 'pipe', 'pipe'] });
|
||||
currentRec = rec;
|
||||
|
||||
audioServer.waitUntilReady.then(() => {
|
||||
audioServer.Server.StdIn = rec.stdout;
|
||||
@@ -251,15 +263,6 @@ checkFFmpeg().then((ffmpegPath) => {
|
||||
connectMessage(`${consoleLogTitle} Connected rec \u2192 FFmpeg \u2192 Server.StdIn${serverConfig.audio.audioBoost && serverConfig.audio.ffmpeg ? ' (audio boost)' : ''}`);
|
||||
});
|
||||
|
||||
process.on('exit', () => {
|
||||
rec.kill('SIGINT');
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
rec.kill('SIGINT');
|
||||
process.exit();
|
||||
});
|
||||
|
||||
rec.stderr.on('data', (data) => {
|
||||
logFfmpeg(`[rec stderr]: ${data}`);
|
||||
});
|
||||
@@ -317,6 +320,17 @@ checkFFmpeg().then((ffmpegPath) => {
|
||||
commandDef.args.splice(commandDef.args.indexOf('pipe:1'), 0, '-af', 'volume=1.7');
|
||||
}
|
||||
|
||||
let currentArecord = null;
|
||||
|
||||
process.on('exit', () => {
|
||||
if (currentArecord) currentArecord.kill('SIGINT');
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
if (currentArecord) currentArecord.kill('SIGINT');
|
||||
process.exit();
|
||||
});
|
||||
|
||||
function startArecord() {
|
||||
if (!serverConfig.audio.ffmpeg) {
|
||||
// Spawn the arecord loop
|
||||
@@ -324,6 +338,7 @@ checkFFmpeg().then((ffmpegPath) => {
|
||||
|
||||
//const arecord = spawn(commandDef.command, { shell: true, stdio: ['ignore', 'pipe', 'pipe'] });
|
||||
const arecord = spawn('arecord', commandDef.arecordArgs, { stdio: ['ignore', 'pipe', 'pipe'] });
|
||||
currentArecord = arecord;
|
||||
|
||||
audioServer.waitUntilReady.then(() => {
|
||||
audioServer.Server.StdIn = arecord.stdout;
|
||||
@@ -331,15 +346,6 @@ checkFFmpeg().then((ffmpegPath) => {
|
||||
connectMessage(`${consoleLogTitle} Connected arecord \u2192 FFmpeg \u2192 Server.StdIn${serverConfig.audio.audioBoost && serverConfig.audio.ffmpeg ? ' (audio boost)' : ''}`);
|
||||
});
|
||||
|
||||
process.on('exit', () => {
|
||||
arecord.kill('SIGINT');
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
arecord.kill('SIGINT');
|
||||
process.exit();
|
||||
});
|
||||
|
||||
arecord.stderr.on('data', (data) => {
|
||||
logFfmpeg(`[arecord stderr]: ${data}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user