1
0
Fork 0

Fix uploading empty master playlist on s3

This commit is contained in:
Chocobozzz 2023-10-26 15:14:14 +02:00
parent 3bd4637014
commit 606c044dc8
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -26,6 +26,7 @@ import { LiveQuotaStore } from '../live-quota-store.js'
import { LiveSegmentShaStore } from '../live-segment-sha-store.js'
import { buildConcatenatedName, getLiveSegmentTime } from '../live-utils.js'
import { AbstractTranscodingWrapper, FFmpegTranscodingWrapper, RemoteTranscodingWrapper } from './transcoding-wrapper/index.js'
import { wait } from '@peertube/peertube-core-utils'
interface MuxingSessionEvents {
'live-ready': (options: { videoUUID: string }) => void
@ -186,7 +187,16 @@ class MuxingSession extends EventEmitter {
try {
if (this.streamingPlaylist.storage === VideoStorage.OBJECT_STORAGE) {
const masterContent = await readFile(path, 'utf-8')
let masterContent = await readFile(path, 'utf-8')
// If the disk sync is slow, don't upload an empty master playlist on object storage
// Wait for ffmpeg to correctly fill it
while (!masterContent) {
await wait(100)
masterContent = await readFile(path, 'utf-8')
}
logger.debug('Uploading live master playlist on object storage for %s', this.videoUUID, { masterContent, ...this.lTags() })
const url = await storeHLSFileFromContent(this.streamingPlaylist, this.streamingPlaylist.playlistFilename, masterContent)