diff options
author | Chocobozzz <me@florianbigard.com> | 2023-04-21 16:31:04 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-05-09 08:57:34 +0200 |
commit | cc2abbc320ea66296bf45314a2efb47d16b38374 (patch) | |
tree | 488882ef5752d790f9e16800fb76dd3dd3cb6a7b /server/lib/transcoding/shared | |
parent | 1772b383de490cf406fe93ef3aa3a941f6db513c (diff) | |
download | PeerTube-cc2abbc320ea66296bf45314a2efb47d16b38374.tar.gz PeerTube-cc2abbc320ea66296bf45314a2efb47d16b38374.tar.zst PeerTube-cc2abbc320ea66296bf45314a2efb47d16b38374.zip |
Fix next video state after optimize/audio merge
Diffstat (limited to 'server/lib/transcoding/shared')
-rw-r--r-- | server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts b/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts index 7c892718b..c09c6b8ce 100644 --- a/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts +++ b/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts | |||
@@ -76,9 +76,10 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder { | |||
76 | 76 | ||
77 | nextTranscodingSequentialJobPayloads = [ ...nextTranscodingSequentialJobPayloads, ...lowerResolutionJobPayloads ] | 77 | nextTranscodingSequentialJobPayloads = [ ...nextTranscodingSequentialJobPayloads, ...lowerResolutionJobPayloads ] |
78 | 78 | ||
79 | const hasChildren = nextTranscodingSequentialJobPayloads.length !== 0 | ||
79 | mergeOrOptimizePayload = videoFile.isAudio() | 80 | mergeOrOptimizePayload = videoFile.isAudio() |
80 | ? this.buildMergeAudioPayload({ videoUUID: video.uuid, isNewVideo }) | 81 | ? this.buildMergeAudioPayload({ videoUUID: video.uuid, isNewVideo, hasChildren }) |
81 | : this.buildOptimizePayload({ videoUUID: video.uuid, isNewVideo, quickTranscode }) | 82 | : this.buildOptimizePayload({ videoUUID: video.uuid, isNewVideo, quickTranscode, hasChildren }) |
82 | }) | 83 | }) |
83 | } finally { | 84 | } finally { |
84 | mutexReleaser() | 85 | mutexReleaser() |
@@ -100,7 +101,9 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder { | |||
100 | 101 | ||
101 | const mergeOrOptimizeJob = await this.buildTranscodingJob({ payload: mergeOrOptimizePayload, user }) | 102 | const mergeOrOptimizeJob = await this.buildTranscodingJob({ payload: mergeOrOptimizePayload, user }) |
102 | 103 | ||
103 | return JobQueue.Instance.createSequentialJobFlow(...[ mergeOrOptimizeJob, transcodingJobBuilderJob ]) | 104 | await JobQueue.Instance.createSequentialJobFlow(...[ mergeOrOptimizeJob, transcodingJobBuilderJob ]) |
105 | |||
106 | await VideoJobInfoModel.increaseOrCreate(video.uuid, 'pendingTranscode') | ||
104 | } | 107 | } |
105 | 108 | ||
106 | // --------------------------------------------------------------------------- | 109 | // --------------------------------------------------------------------------- |
@@ -279,15 +282,17 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder { | |||
279 | private buildMergeAudioPayload (options: { | 282 | private buildMergeAudioPayload (options: { |
280 | videoUUID: string | 283 | videoUUID: string |
281 | isNewVideo: boolean | 284 | isNewVideo: boolean |
285 | hasChildren: boolean | ||
282 | }): MergeAudioTranscodingPayload { | 286 | }): MergeAudioTranscodingPayload { |
283 | const { videoUUID, isNewVideo } = options | 287 | const { videoUUID, isNewVideo, hasChildren } = options |
284 | 288 | ||
285 | return { | 289 | return { |
286 | type: 'merge-audio-to-webtorrent', | 290 | type: 'merge-audio-to-webtorrent', |
287 | resolution: DEFAULT_AUDIO_RESOLUTION, | 291 | resolution: DEFAULT_AUDIO_RESOLUTION, |
288 | fps: VIDEO_TRANSCODING_FPS.AUDIO_MERGE, | 292 | fps: VIDEO_TRANSCODING_FPS.AUDIO_MERGE, |
289 | videoUUID, | 293 | videoUUID, |
290 | isNewVideo | 294 | isNewVideo, |
295 | hasChildren | ||
291 | } | 296 | } |
292 | } | 297 | } |
293 | 298 | ||
@@ -295,13 +300,15 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder { | |||
295 | videoUUID: string | 300 | videoUUID: string |
296 | quickTranscode: boolean | 301 | quickTranscode: boolean |
297 | isNewVideo: boolean | 302 | isNewVideo: boolean |
303 | hasChildren: boolean | ||
298 | }): OptimizeTranscodingPayload { | 304 | }): OptimizeTranscodingPayload { |
299 | const { videoUUID, quickTranscode, isNewVideo } = options | 305 | const { videoUUID, quickTranscode, isNewVideo, hasChildren } = options |
300 | 306 | ||
301 | return { | 307 | return { |
302 | type: 'optimize-to-webtorrent', | 308 | type: 'optimize-to-webtorrent', |
303 | videoUUID, | 309 | videoUUID, |
304 | isNewVideo, | 310 | isNewVideo, |
311 | hasChildren, | ||
305 | quickTranscode | 312 | quickTranscode |
306 | } | 313 | } |
307 | } | 314 | } |