Skip to content

Commit

Permalink
Added graceful termination of rtsp stream
Browse files Browse the repository at this point in the history
  • Loading branch information
campbellbs authored and Sunoo committed Aug 24, 2021
1 parent b330486 commit b299428
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ffmpeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export class FfmpegProcess {
this.process.on('exit', (code: number, signal: NodeJS.Signals) => {
const message = 'FFmpeg exited with code: ' + code + ' and signal: ' + signal;

if (code == null || code === 255) {
if (code == 0) {
log.debug(message + ' (Graceful)', cameraName, debug);
} else if (code == null || code === 255) {
if (this.process.killed) {
log.debug(message + ' (Expected)', cameraName, debug);
} else {
Expand Down Expand Up @@ -123,7 +125,7 @@ export class FfmpegProcess {
}

public stop(): void {
this.process.kill('SIGKILL');
this.process.stdin.write("q\r\n");
}

public getStdin(): Writable {
Expand Down

0 comments on commit b299428

Please sign in to comment.