aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/live-manager.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/live-manager.ts')
-rw-r--r--server/lib/live-manager.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.ts
index d1a0cee91..2702437c4 100644
--- a/server/lib/live-manager.ts
+++ b/server/lib/live-manager.ts
@@ -273,16 +273,20 @@ class LiveManager {
273 273
274 const tsWatcher = chokidar.watch(outPath + '/*.ts') 274 const tsWatcher = chokidar.watch(outPath + '/*.ts')
275 275
276 let segmentsToProcess: string[] = [] 276 const segmentsToProcessPerPlaylist: { [playlistId: string]: string[] } = {}
277 const playlistIdMatcher = /^([\d+])-/
277 278
278 const addHandler = segmentPath => { 279 const addHandler = segmentPath => {
280 const playlistId = basename(segmentPath).match(playlistIdMatcher)[0]
281 const segmentsToProcess = segmentsToProcessPerPlaylist[playlistId] || []
282
279 // Add sha hash of previous segments, because ffmpeg should have finished generating them 283 // Add sha hash of previous segments, because ffmpeg should have finished generating them
280 for (const previousSegment of segmentsToProcess) { 284 for (const previousSegment of segmentsToProcess) {
281 this.addSegmentSha(videoUUID, previousSegment) 285 this.addSegmentSha(videoUUID, previousSegment)
282 .catch(err => logger.error('Cannot add sha segment of video %s -> %s.', videoUUID, previousSegment, { err })) 286 .catch(err => logger.error('Cannot add sha segment of video %s -> %s.', videoUUID, previousSegment, { err }))
283 } 287 }
284 288
285 segmentsToProcess = [ segmentPath ] 289 segmentsToProcessPerPlaylist[playlistId] = [ segmentPath ]
286 290
287 // Duration constraint check 291 // Duration constraint check
288 if (this.isDurationConstraintValid(startStreamDateTime) !== true) { 292 if (this.isDurationConstraintValid(startStreamDateTime) !== true) {