diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-23 10:29:43 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-23 10:30:48 +0200 |
commit | 53023be33af420675d0060eb95c99a8038457564 (patch) | |
tree | 699a13694b0c1c8589d10de95184708a451fcab4 /shared/server-commands | |
parent | 50341c8fe988ca2a3d7c700f9aa918673dc979c2 (diff) | |
download | PeerTube-53023be33af420675d0060eb95c99a8038457564.tar.gz PeerTube-53023be33af420675d0060eb95c99a8038457564.tar.zst PeerTube-53023be33af420675d0060eb95c99a8038457564.zip |
Fix fast restream in saved permanent live
Diffstat (limited to 'shared/server-commands')
-rw-r--r-- | shared/server-commands/server/config-command.ts | 9 | ||||
-rw-r--r-- | shared/server-commands/videos/live-command.ts | 28 |
2 files changed, 30 insertions, 7 deletions
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 { | |||
39 | enableLive (options: { | 39 | enableLive (options: { |
40 | allowReplay?: boolean | 40 | allowReplay?: boolean |
41 | transcoding?: boolean | 41 | transcoding?: boolean |
42 | resolutions?: 'min' | 'max' // Default max | ||
42 | } = {}) { | 43 | } = {}) { |
44 | const { allowReplay, transcoding, resolutions = 'max' } = options | ||
45 | |||
43 | return this.updateExistingSubConfig({ | 46 | return this.updateExistingSubConfig({ |
44 | newConfig: { | 47 | newConfig: { |
45 | live: { | 48 | live: { |
46 | enabled: true, | 49 | enabled: true, |
47 | allowReplay: options.allowReplay ?? true, | 50 | allowReplay: allowReplay ?? true, |
48 | transcoding: { | 51 | transcoding: { |
49 | enabled: options.transcoding ?? true, | 52 | enabled: transcoding ?? true, |
50 | resolutions: ConfigCommand.getCustomConfigResolutions(true) | 53 | resolutions: ConfigCommand.getCustomConfigResolutions(resolutions === 'max') |
51 | } | 54 | } |
52 | } | 55 | } |
53 | } | 56 | } |
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 { | |||
154 | 154 | ||
155 | waitUntilSegmentGeneration (options: OverrideCommandOptions & { | 155 | waitUntilSegmentGeneration (options: OverrideCommandOptions & { |
156 | videoUUID: string | 156 | videoUUID: string |
157 | resolution: number | 157 | playlistNumber: number |
158 | segment: number | 158 | segment: number |
159 | totalSessions?: number | ||
159 | }) { | 160 | }) { |
160 | const { resolution, segment, videoUUID } = options | 161 | const { playlistNumber, segment, videoUUID, totalSessions = 1 } = options |
161 | const segmentName = `${resolution}-00000${segment}.ts` | 162 | const segmentName = `${playlistNumber}-00000${segment}.ts` |
162 | 163 | ||
163 | return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false) | 164 | return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, totalSessions * 2, false) |
165 | } | ||
166 | |||
167 | getSegment (options: OverrideCommandOptions & { | ||
168 | videoUUID: string | ||
169 | playlistNumber: number | ||
170 | segment: number | ||
171 | }) { | ||
172 | const { playlistNumber, segment, videoUUID } = options | ||
173 | |||
174 | const segmentName = `${playlistNumber}-00000${segment}.ts` | ||
175 | const url = `${this.server.url}/static/streaming-playlists/hls/${videoUUID}/${segmentName}` | ||
176 | |||
177 | return this.getRawRequest({ | ||
178 | ...options, | ||
179 | |||
180 | url, | ||
181 | implicitToken: false, | ||
182 | defaultExpectedStatus: HttpStatusCode.OK_200 | ||
183 | }) | ||
164 | } | 184 | } |
165 | 185 | ||
166 | async waitUntilReplacedByReplay (options: OverrideCommandOptions & { | 186 | async waitUntilReplacedByReplay (options: OverrideCommandOptions & { |