Reload the video after waiting for the files lock
This commit is contained in:
parent
e7d8e2b245
commit
a687879e94
|
@ -35,6 +35,9 @@ async function doCreateAction (payload: ManageVideoTorrentPayload & { action: 'c
|
||||||
const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
|
const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await video.reload()
|
||||||
|
await file.reload()
|
||||||
|
|
||||||
await createTorrentAndSetInfoHash(video, file)
|
await createTorrentAndSetInfoHash(video, file)
|
||||||
|
|
||||||
// Refresh videoFile because the createTorrentAndSetInfoHash could be long
|
// Refresh videoFile because the createTorrentAndSetInfoHash could be long
|
||||||
|
|
|
@ -19,17 +19,18 @@ export async function processMoveToObjectStorage (job: Job) {
|
||||||
const payload = job.data as MoveObjectStoragePayload
|
const payload = job.data as MoveObjectStoragePayload
|
||||||
logger.info('Moving video %s in job %s.', payload.videoUUID, job.id)
|
logger.info('Moving video %s in job %s.', payload.videoUUID, job.id)
|
||||||
|
|
||||||
|
const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(payload.videoUUID)
|
||||||
|
|
||||||
const video = await VideoModel.loadWithFiles(payload.videoUUID)
|
const video = await VideoModel.loadWithFiles(payload.videoUUID)
|
||||||
// No video, maybe deleted?
|
// No video, maybe deleted?
|
||||||
if (!video) {
|
if (!video) {
|
||||||
logger.info('Can\'t process job %d, video does not exist.', job.id, lTagsBase(payload.videoUUID))
|
logger.info('Can\'t process job %d, video does not exist.', job.id, lTagsBase(payload.videoUUID))
|
||||||
|
fileMutexReleaser()
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
const lTags = lTagsBase(video.uuid, video.url)
|
const lTags = lTagsBase(video.uuid, video.url)
|
||||||
|
|
||||||
const fileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (video.VideoFiles) {
|
if (video.VideoFiles) {
|
||||||
logger.debug('Moving %d webtorrent files for video %s.', video.VideoFiles.length, video.uuid, lTags)
|
logger.debug('Moving %d webtorrent files for video %s.', video.VideoFiles.length, video.uuid, lTags)
|
||||||
|
|
|
@ -218,6 +218,7 @@ async function assignReplayFilesToVideo (options: {
|
||||||
|
|
||||||
for (const concatenatedTsFile of concatenatedTsFiles) {
|
for (const concatenatedTsFile of concatenatedTsFiles) {
|
||||||
const inputFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
|
const inputFileMutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
|
||||||
|
await video.reload()
|
||||||
|
|
||||||
const concatenatedTsFilePath = join(replayDirectory, concatenatedTsFile)
|
const concatenatedTsFilePath = join(replayDirectory, concatenatedTsFile)
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,6 @@ export async function onHLSVideoFileTranscoding (options: {
|
||||||
const mutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
|
const mutexReleaser = await VideoPathManager.Instance.lockFiles(video.uuid)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// VOD transcoding is a long task, refresh video attributes
|
|
||||||
await video.reload()
|
await video.reload()
|
||||||
|
|
||||||
const videoFilePath = VideoPathManager.Instance.getFSVideoFileOutputPath(playlist, videoFile)
|
const videoFilePath = VideoPathManager.Instance.getFSVideoFileOutputPath(playlist, videoFile)
|
||||||
|
|
|
@ -40,6 +40,9 @@ export class TranscodingJobQueueBuilder extends AbstractJobBuilder {
|
||||||
: await VideoPathManager.Instance.lockFiles(video.uuid)
|
: await VideoPathManager.Instance.lockFiles(video.uuid)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await video.reload()
|
||||||
|
await videoFile.reload()
|
||||||
|
|
||||||
await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => {
|
await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => {
|
||||||
const probe = await ffprobePromise(videoFilePath)
|
const probe = await ffprobePromise(videoFilePath)
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,9 @@ export class TranscodingRunnerJobBuilder extends AbstractJobBuilder {
|
||||||
: await VideoPathManager.Instance.lockFiles(video.uuid)
|
: await VideoPathManager.Instance.lockFiles(video.uuid)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await video.reload()
|
||||||
|
await videoFile.reload()
|
||||||
|
|
||||||
await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => {
|
await VideoPathManager.Instance.makeAvailableVideoFile(videoFile.withVideoOrPlaylist(video), async videoFilePath => {
|
||||||
const probe = await ffprobePromise(videoFilePath)
|
const probe = await ffprobePromise(videoFilePath)
|
||||||
|
|
||||||
|
|
|
@ -183,8 +183,10 @@ describe('Test Live transcoding in peertube-runner program', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async function () {
|
after(async function () {
|
||||||
await peertubeRunner.unregisterPeerTubeInstance({ server: servers[0] })
|
if (peertubeRunner) {
|
||||||
peertubeRunner.kill()
|
await peertubeRunner.unregisterPeerTubeInstance({ server: servers[0] })
|
||||||
|
peertubeRunner.kill()
|
||||||
|
}
|
||||||
|
|
||||||
await cleanupTests(servers)
|
await cleanupTests(servers)
|
||||||
})
|
})
|
||||||
|
|
|
@ -108,8 +108,10 @@ describe('Test studio transcoding in peertube-runner program', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async function () {
|
after(async function () {
|
||||||
await peertubeRunner.unregisterPeerTubeInstance({ server: servers[0] })
|
if (peertubeRunner) {
|
||||||
peertubeRunner.kill()
|
await peertubeRunner.unregisterPeerTubeInstance({ server: servers[0] })
|
||||||
|
peertubeRunner.kill()
|
||||||
|
}
|
||||||
|
|
||||||
await cleanupTests(servers)
|
await cleanupTests(servers)
|
||||||
})
|
})
|
||||||
|
|
|
@ -334,8 +334,10 @@ describe('Test VOD transcoding in peertube-runner program', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
after(async function () {
|
after(async function () {
|
||||||
await peertubeRunner.unregisterPeerTubeInstance({ server: servers[0] })
|
if (peertubeRunner) {
|
||||||
peertubeRunner.kill()
|
await peertubeRunner.unregisterPeerTubeInstance({ server: servers[0] })
|
||||||
|
peertubeRunner.kill()
|
||||||
|
}
|
||||||
|
|
||||||
await cleanupTests(servers)
|
await cleanupTests(servers)
|
||||||
})
|
})
|
||||||
|
|
|
@ -21,8 +21,8 @@ function sendRTMPStream (options: {
|
||||||
command.outputOption('-c copy')
|
command.outputOption('-c copy')
|
||||||
} else {
|
} else {
|
||||||
command.outputOption('-c:v libx264')
|
command.outputOption('-c:v libx264')
|
||||||
command.outputOption('-g 50')
|
command.outputOption('-g 120')
|
||||||
command.outputOption('-keyint_min 2')
|
command.outputOption('-x264-params "no-scenecut=1"')
|
||||||
command.outputOption('-r 60')
|
command.outputOption('-r 60')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue