Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix live sha segments with multiple resolutions

Chocobozzz786b855af726
diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.ts
index d1a0cee91f..2702437c42 100644
--- a/server/lib/live-manager.ts
+++ b/server/lib/live-manager.ts
@@ -273,16 +273,20 @@ class LiveManager {
const tsWatcher = chokidar.watch(outPath + '/*.ts')
- let segmentsToProcess: string[] = []
+ const segmentsToProcessPerPlaylist: { [playlistId: string]: string[] } = {}
+ const playlistIdMatcher = /^([\d+])-/
const addHandler = segmentPath => {
+ const playlistId = basename(segmentPath).match(playlistIdMatcher)[0]
+ const segmentsToProcess = segmentsToProcessPerPlaylist[playlistId] || []
+
// Add sha hash of previous segments, because ffmpeg should have finished generating them
for (const previousSegment of segmentsToProcess) {
this.addSegmentSha(videoUUID, previousSegment)
.catch(err => logger.error('Cannot add sha segment of video %s -> %s.', videoUUID, previousSegment, { err }))
}
- segmentsToProcess = [ segmentPath ]
+ segmentsToProcessPerPlaylist[playlistId] = [ segmentPath ]
// Duration constraint check
if (this.isDurationConstraintValid(startStreamDateTime) !== true) {