From 39d117a47d313637cf3ded4c6fa915aa9fd469ee Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 13 Jul 2022 10:32:32 +0200 Subject: Prevent error logs when aborting a stream --- server/lib/live/shared/muxing-session.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'server/lib/live/shared') diff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.ts index 98a7b2613..036d9d142 100644 --- a/server/lib/live/shared/muxing-session.ts +++ b/server/lib/live/shared/muxing-session.ts @@ -73,6 +73,8 @@ class MuxingSession extends EventEmitter { private tsWatcher: FSWatcher private masterWatcher: FSWatcher + private aborted = false + private readonly isAbleToUploadVideoWithCache = memoizee((userId: number) => { return isAbleToUploadVideo(userId, 1000) }, { maxAge: MEMOIZE_TTL.LIVE_ABLE_TO_UPLOAD }) @@ -176,6 +178,7 @@ class MuxingSession extends EventEmitter { abort () { if (!this.ffmpegCommand) return + this.aborted = true this.ffmpegCommand.kill('SIGINT') } @@ -246,6 +249,8 @@ class MuxingSession extends EventEmitter { const playlistIdMatcher = /^([\d+])-/ const addHandler = async (segmentPath: string) => { + if (this.aborted) return + logger.debug('Live add handler of %s.', segmentPath, this.lTags()) const playlistId = basename(segmentPath).match(playlistIdMatcher)[0] @@ -332,6 +337,8 @@ class MuxingSession extends EventEmitter { } private processSegments (segmentPaths: string[]) { + if (this.aborted) return + mapSeries(segmentPaths, async previousSegment => { // Add sha hash of previous segments, because ffmpeg should have finished generating them await LiveSegmentShaStore.Instance.addSegmentSha(this.videoUUID, previousSegment) -- cgit v1.2.3