aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/live
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-13 10:32:32 +0200
committerChocobozzz <me@florianbigard.com>2022-07-13 10:57:04 +0200
commit39d117a47d313637cf3ded4c6fa915aa9fd469ee (patch)
treecdfcaf66bd7861e04abbd321a963c3afa19ecffd /server/lib/live
parent14f7ad399fddd00362eabdf8d32e453ebc8be453 (diff)
downloadPeerTube-39d117a47d313637cf3ded4c6fa915aa9fd469ee.tar.gz
PeerTube-39d117a47d313637cf3ded4c6fa915aa9fd469ee.tar.zst
PeerTube-39d117a47d313637cf3ded4c6fa915aa9fd469ee.zip
Prevent error logs when aborting a stream
Diffstat (limited to 'server/lib/live')
-rw-r--r--server/lib/live/shared/muxing-session.ts7
1 files changed, 7 insertions, 0 deletions
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 {
73 private tsWatcher: FSWatcher 73 private tsWatcher: FSWatcher
74 private masterWatcher: FSWatcher 74 private masterWatcher: FSWatcher
75 75
76 private aborted = false
77
76 private readonly isAbleToUploadVideoWithCache = memoizee((userId: number) => { 78 private readonly isAbleToUploadVideoWithCache = memoizee((userId: number) => {
77 return isAbleToUploadVideo(userId, 1000) 79 return isAbleToUploadVideo(userId, 1000)
78 }, { maxAge: MEMOIZE_TTL.LIVE_ABLE_TO_UPLOAD }) 80 }, { maxAge: MEMOIZE_TTL.LIVE_ABLE_TO_UPLOAD })
@@ -176,6 +178,7 @@ class MuxingSession extends EventEmitter {
176 abort () { 178 abort () {
177 if (!this.ffmpegCommand) return 179 if (!this.ffmpegCommand) return
178 180
181 this.aborted = true
179 this.ffmpegCommand.kill('SIGINT') 182 this.ffmpegCommand.kill('SIGINT')
180 } 183 }
181 184
@@ -246,6 +249,8 @@ class MuxingSession extends EventEmitter {
246 const playlistIdMatcher = /^([\d+])-/ 249 const playlistIdMatcher = /^([\d+])-/
247 250
248 const addHandler = async (segmentPath: string) => { 251 const addHandler = async (segmentPath: string) => {
252 if (this.aborted) return
253
249 logger.debug('Live add handler of %s.', segmentPath, this.lTags()) 254 logger.debug('Live add handler of %s.', segmentPath, this.lTags())
250 255
251 const playlistId = basename(segmentPath).match(playlistIdMatcher)[0] 256 const playlistId = basename(segmentPath).match(playlistIdMatcher)[0]
@@ -332,6 +337,8 @@ class MuxingSession extends EventEmitter {
332 } 337 }
333 338
334 private processSegments (segmentPaths: string[]) { 339 private processSegments (segmentPaths: string[]) {
340 if (this.aborted) return
341
335 mapSeries(segmentPaths, async previousSegment => { 342 mapSeries(segmentPaths, async previousSegment => {
336 // Add sha hash of previous segments, because ffmpeg should have finished generating them 343 // Add sha hash of previous segments, because ffmpeg should have finished generating them
337 await LiveSegmentShaStore.Instance.addSegmentSha(this.videoUUID, previousSegment) 344 await LiveSegmentShaStore.Instance.addSegmentSha(this.videoUUID, previousSegment)