Fix live sha segments with multiple resolutions

pull/3313/head
Chocobozzz 2020-11-13 10:16:22 +01:00
parent 17119e4a54
commit 786b855af7
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 6 additions and 2 deletions

View File

@ -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) {