aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/lib/job-queue/handlers/manage-video-torrent.ts3
-rw-r--r--server/lib/job-queue/handlers/move-to-object-storage.ts5
-rw-r--r--server/lib/job-queue/handlers/video-live-ending.ts1
-rw-r--r--server/lib/transcoding/hls-transcoding.ts1
-rw-r--r--server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts3
-rw-r--r--server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts3
-rw-r--r--server/tests/peertube-runner/live-transcoding.ts6
-rw-r--r--server/tests/peertube-runner/studio-transcoding.ts6
-rw-r--r--server/tests/peertube-runner/vod-transcoding.ts6
-rw-r--r--shared/server-commands/videos/live.ts4
10 files changed, 27 insertions, 11 deletions
diff --git a/server/lib/job-queue/handlers/manage-video-torrent.ts b/server/lib/job-queue/handlers/manage-video-torrent.ts
index cef93afda..edf52de0c 100644
--- a/server/lib/job-queue/handlers/manage-video-torrent.ts
+++ b/server/lib/job-queue/handlers/manage-video-torrent.ts
@@ -35,6 +35,9 @@ async function doCreateAction (payload: ManageVideoTorrentPayload & { action: 'c
35 const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) 35 const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
36 36
37 try { 37 try {
38 await video.reload()
39 await file.reload()
40
38 await createTorrentAndSetInfoHash(video, file) 41 await createTorrentAndSetInfoHash(video, file)
39 42
40 // Refresh videoFile because the createTorrentAndSetInfoHash could be long 43 // Refresh videoFile because the createTorrentAndSetInfoHash could be long
diff --git a/server/lib/job-queue/handlers/move-to-object-storage.ts b/server/lib/job-queue/handlers/move-to-object-storage.ts
index a1530cc57..26752ff37 100644
--- a/server/lib/job-queue/handlers/move-to-object-storage.ts
+++ b/server/lib/job-queue/handlers/move-to-object-storage.ts
@@ -19,17 +19,18 @@ export async function processMoveToObjectStorage (job: Job) {
19 const payload = job.data as MoveObjectStoragePayload 19 const payload = job.data as MoveObjectStoragePayload
20 logger.info('Moving video %s in job %s.', payload.videoUUID, job.id) 20 logger.info('Moving video %s in job %s.', payload.videoUUID, job.id)
21 21
22 const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(payload.videoUUID)
23
22 const video = await VideoModel.loadWithFiles(payload.videoUUID) 24 const video = await VideoModel.loadWithFiles(payload.videoUUID)
23 // No video, maybe deleted? 25 // No video, maybe deleted?
24 if (!video) { 26 if (!video) {
25 logger.info('Can\'t process job %d, video does not exist.', job.id, lTagsBase(payload.videoUUID)) 27 logger.info('Can\'t process job %d, video does not exist.', job.id, lTagsBase(payload.videoUUID))
28 fileMutexReleaser()
26 return undefined 29 return undefined
27 } 30 }
28 31
29 const lTags = lTagsBase(video.uuid, video.url) 32 const lTags = lTagsBase(video.uuid, video.url)
30 33
31 const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
32
33 try { 34 try {
34 if (video.VideoFiles) { 35 if (video.VideoFiles) {
35 logger.debug('Moving %d webtorrent files for video %s.', video.VideoFiles.length, video.uuid, lTags) 36 logger.debug('Moving %d webtorrent files for video %s.', video.VideoFiles.length, video.uuid, lTags)
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts
index 1bf43f592..814f313a3 100644
--- a/server/lib/job-queue/handlers/video-live-ending.ts
+++ b/server/lib/job-queue/handlers/video-live-ending.ts
@@ -218,6 +218,7 @@ async function assignReplayFilesToVideo (options: {
218 218
219 for (const concatenatedTsFile of concatenatedTsFiles) { 219 for (const concatenatedTsFile of concatenatedTsFiles) {
220 const inputFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) 220 const inputFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
221 await video.reload()
221 222
222 const concatenatedTsFilePath = join(replayDirectory, concatenatedTsFile) 223 const concatenatedTsFilePath = join(replayDirectory, concatenatedTsFile)
223 224
diff --git a/server/lib/transcoding/hls-transcoding.ts b/server/lib/transcoding/hls-transcoding.ts
index cffa859c7..2c325d9ee 100644
--- a/server/lib/transcoding/hls-transcoding.ts
+++ b/server/lib/transcoding/hls-transcoding.ts
@@ -72,7 +72,6 @@ export async function onHLSVideoFileTranscoding (options: {
72 const mutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid) 72 const mutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
73 73
74 try { 74 try {
75 // VOD transcoding is a long task, refresh video attributes
76 await video.reload() 75 await video.reload()
77 76
78 const videoFilePath = VideoPathManager.Instance.getFSVideoFileOutputPath(playlist, videoFile) 77 const videoFilePath = VideoPathManager.Instance.getFSVideoFileOutputPath(playlist, videoFile)
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 29ee2ca61..fa2ac70bf 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
@@ -40,6 +40,9 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
40 : await VideoPathManager.Instance.lockFiles(video.uuid) 40 : await VideoPathManager.Instance.lockFiles(video.uuid)
41 41
42 try { 42 try {
43 await video.reload()
44 await videoFile.reload()
45
43 await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => { 46 await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => {
44 const probe = await ffprobePromise(videoFilePath) 47 const probe = await ffprobePromise(videoFilePath)
45 48
diff --git a/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts b/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts
index 90b035402..4b8bc2f3d 100644
--- a/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts
+++ b/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts
@@ -36,6 +36,9 @@ export class TranscodingRunnerJobBuilder extends AbstractJobBuilder {
36 : await VideoPathManager.Instance.lockFiles(video.uuid) 36 : await VideoPathManager.Instance.lockFiles(video.uuid)
37 37
38 try { 38 try {
39 await video.reload()
40 await videoFile.reload()
41
39 await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => { 42 await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => {
40 const probe = await ffprobePromise(videoFilePath) 43 const probe = await ffprobePromise(videoFilePath)
41 44
diff --git a/server/tests/peertube-runner/live-transcoding.ts b/server/tests/peertube-runner/live-transcoding.ts
index 31716d545..f0acf25c8 100644
--- a/server/tests/peertube-runner/live-transcoding.ts
+++ b/server/tests/peertube-runner/live-transcoding.ts
@@ -183,8 +183,10 @@ describe('Test Live transcoding in peertube-runner program', function () {
183 }) 183 })
184 184
185 after(async function () { 185 after(async function () {
186 await peertubeRunner.unregisterPeerTubeInstance({ server: servers[0] }) 186 if (peertubeRunner) {
187 peertubeRunner.kill() 187 await peertubeRunner.unregisterPeerTubeInstance({ server: servers[0] })
188 peertubeRunner.kill()
189 }
188 190
189 await cleanupTests(servers) 191 await cleanupTests(servers)
190 }) 192 })
diff --git a/server/tests/peertube-runner/studio-transcoding.ts b/server/tests/peertube-runner/studio-transcoding.ts
index 204836c4d..e20cc9041 100644
--- a/server/tests/peertube-runner/studio-transcoding.ts
+++ b/server/tests/peertube-runner/studio-transcoding.ts
@@ -108,8 +108,10 @@ describe('Test studio transcoding in peertube-runner program', function () {
108 }) 108 })
109 109
110 after(async function () { 110 after(async function () {
111 await peertubeRunner.unregisterPeerTubeInstance({ server: servers[0] }) 111 if (peertubeRunner) {
112 peertubeRunner.kill() 112 await peertubeRunner.unregisterPeerTubeInstance({ server: servers[0] })
113 peertubeRunner.kill()
114 }
113 115
114 await cleanupTests(servers) 116 await cleanupTests(servers)
115 }) 117 })
diff --git a/server/tests/peertube-runner/vod-transcoding.ts b/server/tests/peertube-runner/vod-transcoding.ts
index 3a9abba93..3c0918102 100644
--- a/server/tests/peertube-runner/vod-transcoding.ts
+++ b/server/tests/peertube-runner/vod-transcoding.ts
@@ -334,8 +334,10 @@ describe('Test VOD transcoding in peertube-runner program', function () {
334 }) 334 })
335 335
336 after(async function () { 336 after(async function () {
337 await peertubeRunner.unregisterPeerTubeInstance({ server: servers[0] }) 337 if (peertubeRunner) {
338 peertubeRunner.kill() 338 await peertubeRunner.unregisterPeerTubeInstance({ server: servers[0] })
339 peertubeRunner.kill()
340 }
339 341
340 await cleanupTests(servers) 342 await cleanupTests(servers)
341 }) 343 })
diff --git a/shared/server-commands/videos/live.ts b/shared/server-commands/videos/live.ts
index 578e6ede7..3b09d3ff8 100644
--- a/shared/server-commands/videos/live.ts
+++ b/shared/server-commands/videos/live.ts
@@ -21,8 +21,8 @@ function sendRTMPStream (options: {
21 command.outputOption('-c copy') 21 command.outputOption('-c copy')
22 } else { 22 } else {
23 command.outputOption('-c:v libx264') 23 command.outputOption('-c:v libx264')
24 command.outputOption('-g 50') 24 command.outputOption('-g 120')
25 command.outputOption('-keyint_min 2') 25 command.outputOption('-x264-params "no-scenecut=1"')
26 command.outputOption('-r 60') 26 command.outputOption('-r 60')
27 } 27 }
28 28