aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/live-manager.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-13 10:16:22 +0100
committerChocobozzz <me@florianbigard.com>2020-11-13 12:02:29 +0100
commit786b855af726599a9c877eefa6fa8508c36e1aca (patch)
tree208384ba97da0f38883be686a625d6611477bbb6 /server/lib/live-manager.ts
parent17119e4a546522468878cf115558b17949ab50d0 (diff)
downloadPeerTube-786b855af726599a9c877eefa6fa8508c36e1aca.tar.gz
PeerTube-786b855af726599a9c877eefa6fa8508c36e1aca.tar.zst
PeerTube-786b855af726599a9c877eefa6fa8508c36e1aca.zip
Fix live sha segments with multiple resolutions
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) {