Correctly delete web videos with hls without audio

This commit is contained in:
Chocobozzz 2024-11-04 09:50:15 +01:00
parent 7476abe8b5
commit 11fd3a4618
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 28 additions and 3 deletions

View File

@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { join } from 'path'
import { HttpStatusCode } from '@peertube/peertube-models'
import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'
import {
@ -15,6 +14,7 @@ import {
import { DEFAULT_AUDIO_RESOLUTION } from '@peertube/peertube-server/core/initializers/constants.js'
import { checkDirectoryIsEmpty, checkTmpIsEmpty } from '@tests/shared/directories.js'
import { completeCheckHlsPlaylist } from '@tests/shared/streaming-playlists.js'
import { join } from 'path'
describe('Test HLS videos', function () {
let servers: PeerTubeServer[] = []
@ -49,6 +49,17 @@ describe('Test HLS videos', function () {
await completeCheckHlsPlaylist({ servers, videoUUID: uuid, hlsOnly, objectStorageBaseUrl })
})
it('Should upload a video without audio', async function () {
this.timeout(120_000)
const { uuid } = await servers[0].videos.upload({ attributes: { name: 'no audio', fixture: 'video_short_no_audio.mp4' } })
videoUUIDs.push(uuid)
await waitJobs(servers)
await completeCheckHlsPlaylist({ servers, videoUUID: uuid, hlsOnly, hasAudio: false, objectStorageBaseUrl })
})
it('Should upload an audio file and transcode it to HLS', async function () {
this.timeout(120000)

View File

@ -68,6 +68,17 @@ describe('Test HLS with audio and video splitted', function () {
})
})
it('Should upload a video without audio', async function () {
this.timeout(120_000)
const { uuid } = await servers[0].videos.upload({ attributes: { name: 'no audio', fixture: 'video_short_no_audio.mp4' } })
videoUUIDs.push(uuid)
await waitJobs(servers)
await completeCheckHlsPlaylist({ servers, videoUUID: uuid, hlsOnly, hasAudio: false, objectStorageBaseUrl })
})
it('Should update the video', async function () {
this.timeout(30000)

View File

@ -72,6 +72,8 @@ export abstract class AbstractJobBuilder <P> {
// HLS version of max resolution
if (CONFIG.TRANSCODING.HLS.ENABLED === true) {
const hasSplitAndioTranscoding = CONFIG.TRANSCODING.HLS.SPLIT_AUDIO_AND_VIDEO && videoFile.hasAudio()
// We had some issues with a web video quick transcoded while producing a HLS version of it
const copyCodecs = !quickTranscode
@ -79,7 +81,8 @@ export abstract class AbstractJobBuilder <P> {
hlsPayloads.push(
this.buildHLSJobPayload({
deleteWebVideoFiles: !CONFIG.TRANSCODING.HLS.SPLIT_AUDIO_AND_VIDEO && !CONFIG.TRANSCODING.WEB_VIDEOS.ENABLED,
deleteWebVideoFiles: !CONFIG.TRANSCODING.WEB_VIDEOS.ENABLED && !hasSplitAndioTranscoding,
separatedAudio: CONFIG.TRANSCODING.HLS.SPLIT_AUDIO_AND_VIDEO,
copyCodecs,
@ -91,7 +94,7 @@ export abstract class AbstractJobBuilder <P> {
})
)
if (CONFIG.TRANSCODING.HLS.SPLIT_AUDIO_AND_VIDEO && videoFile.hasAudio()) {
if (hasSplitAndioTranscoding) {
hlsAudioAlreadyGenerated = true
hlsPayloads.push(