From 53023be33af420675d0060eb95c99a8038457564 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 23 Jun 2022 10:29:43 +0200 Subject: Fix fast restream in saved permanent live --- shared/server-commands/server/config-command.ts | 9 +++++--- shared/server-commands/videos/live-command.ts | 28 +++++++++++++++++++++---- 2 files changed, 30 insertions(+), 7 deletions(-) (limited to 'shared/server-commands') diff --git a/shared/server-commands/server/config-command.ts b/shared/server-commands/server/config-command.ts index 5320dead4..3803aaf95 100644 --- a/shared/server-commands/server/config-command.ts +++ b/shared/server-commands/server/config-command.ts @@ -39,15 +39,18 @@ export class ConfigCommand extends AbstractCommand { enableLive (options: { allowReplay?: boolean transcoding?: boolean + resolutions?: 'min' | 'max' // Default max } = {}) { + const { allowReplay, transcoding, resolutions = 'max' } = options + return this.updateExistingSubConfig({ newConfig: { live: { enabled: true, - allowReplay: options.allowReplay ?? true, + allowReplay: allowReplay ?? true, transcoding: { - enabled: options.transcoding ?? true, - resolutions: ConfigCommand.getCustomConfigResolutions(true) + enabled: transcoding ?? true, + resolutions: ConfigCommand.getCustomConfigResolutions(resolutions === 'max') } } } diff --git a/shared/server-commands/videos/live-command.ts b/shared/server-commands/videos/live-command.ts index 2ff65881b..3df47ed4d 100644 --- a/shared/server-commands/videos/live-command.ts +++ b/shared/server-commands/videos/live-command.ts @@ -154,13 +154,33 @@ export class LiveCommand extends AbstractCommand { waitUntilSegmentGeneration (options: OverrideCommandOptions & { videoUUID: string - resolution: number + playlistNumber: number segment: number + totalSessions?: number }) { - const { resolution, segment, videoUUID } = options - const segmentName = `${resolution}-00000${segment}.ts` + const { playlistNumber, segment, videoUUID, totalSessions = 1 } = options + const segmentName = `${playlistNumber}-00000${segment}.ts` - return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false) + return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, totalSessions * 2, false) + } + + getSegment (options: OverrideCommandOptions & { + videoUUID: string + playlistNumber: number + segment: number + }) { + const { playlistNumber, segment, videoUUID } = options + + const segmentName = `${playlistNumber}-00000${segment}.ts` + const url = `${this.server.url}/static/streaming-playlists/hls/${videoUUID}/${segmentName}` + + return this.getRawRequest({ + ...options, + + url, + implicitToken: false, + defaultExpectedStatus: HttpStatusCode.OK_200 + }) } async waitUntilReplacedByReplay (options: OverrideCommandOptions & { -- cgit v1.2.3