Merge branch 'release/3.4.0' into develop

pull/4461/head
Chocobozzz 2021-10-12 13:50:48 +02:00
commit 10ef089102
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
12 changed files with 28 additions and 18 deletions

View File

@ -144,6 +144,7 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
}
canDeactivate (): { canDeactivate: boolean, text?: string} {
if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
if (this.secondStepType === 'import-url') return this.videoImportUrl.canDeactivate()
if (this.secondStepType === 'import-torrent') return this.videoImportTorrent.canDeactivate()
if (this.secondStepType === 'go-live') return this.videoGoLive.canDeactivate()

View File

@ -302,7 +302,10 @@ function computeFPS (fpsArg: number, resolution: VideoResolution) {
// Hard FPS limits
if (fps > VIDEO_TRANSCODING_FPS.MAX) fps = getClosestFramerateStandard(fps, 'HD_STANDARD')
else if (fps < VIDEO_TRANSCODING_FPS.MIN) fps = VIDEO_TRANSCODING_FPS.MIN
if (fps < VIDEO_TRANSCODING_FPS.MIN) {
throw new Error(`Cannot compute FPS because ${fps} is lower than our minimum value ${VIDEO_TRANSCODING_FPS.MIN}`)
}
return fps
}

View File

@ -346,7 +346,7 @@ const VIEW_LIFETIME = {
let CONTACT_FORM_LIFETIME = 60000 * 60 // 1 hour
const VIDEO_TRANSCODING_FPS: VideoTranscodingFPS = {
MIN: 10,
MIN: 1,
STANDARD: [ 24, 25, 30 ],
HD_STANDARD: [ 50, 60 ],
AVERAGE: 30,

View File

@ -517,10 +517,16 @@ describe('Test live', function () {
await waitUntilLivePublishedOnAllServers(servers, liveVideoId)
const bitrateLimits = {
720: 5000 * 1000, // 60FPS
360: 1100 * 1000,
240: 600 * 1000
const maxBitrateLimits = {
720: 6500 * 1000, // 60FPS
360: 1250 * 1000,
240: 700 * 1000
}
const minBitrateLimits = {
720: 5500 * 1000,
360: 1000 * 1000,
240: 550 * 1000
}
for (const server of servers) {
@ -560,7 +566,8 @@ describe('Test live', function () {
const probe = await ffprobePromise(segmentPath)
const videoStream = await getVideoStreamFromFile(segmentPath, probe)
expect(probe.format.bit_rate).to.be.below(bitrateLimits[videoStream.height])
expect(probe.format.bit_rate).to.be.below(maxBitrateLimits[videoStream.height])
expect(probe.format.bit_rate).to.be.at.least(minBitrateLimits[videoStream.height])
await makeRawRequest(file.torrentUrl, HttpStatusCode.OK_200)
await makeRawRequest(file.fileUrl, HttpStatusCode.OK_200)

View File

@ -11,7 +11,6 @@ import {
doubleFollow,
generateHighBitrateVideo,
generateVideoWithFramerate,
getFileSize,
makeGetRequest,
PeerTubeServer,
setAccessTokensToServers,
@ -617,8 +616,8 @@ describe('Test video transcoding', function () {
const file = video.files.find(f => f.resolution.id === r)
const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl)
const size = await getFileSize(path)
expect(size, `${path} not below ${60_000}`).to.be.below(60_000)
const bitrate = await getVideoFileBitrate(path)
expect(bitrate, `${path} not below ${60_000}`).to.be.below(60_000)
}
})
})

View File

@ -9,7 +9,7 @@ import { VideoResolution } from '../../../shared/models/videos'
const expect = chai.expect
describe('Test create transcoding jobs', function () {
describe('Test print transcode jobs', function () {
it('Should print the correct command for each resolution', async function () {
const fixturePath = buildAbsoluteFixturePath('video_short.webm')
@ -21,7 +21,7 @@ describe('Test create transcoding jobs', function () {
VideoResolution.H_1080P
]) {
const command = await CLICommand.exec(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`)
const targetBitrate = Math.min(getMaxBitrate({ resolution, fps, ratio: 16 / 9 }), bitrate)
const targetBitrate = Math.min(getMaxBitrate({ resolution, fps, ratio: 16 / 9 }), bitrate + (bitrate * 0.3))
expect(command).to.includes(`-vf scale=w=-2:h=${resolution}`)
expect(command).to.includes(`-y -acodec aac -vcodec libx264`)

View File

@ -78,7 +78,7 @@ function calculateBitrate (options: {
for (const toTestResolution of resolutionsOrder) {
if (toTestResolution <= resolution) {
return resolution * resolution * ratio * fps * bitPerPixel[toTestResolution]
return Math.floor(resolution * resolution * ratio * fps * bitPerPixel[toTestResolution])
}
}

View File

@ -29,7 +29,7 @@ export class MockInstancesIndex {
})
})
const port = 42101 + randomInt(1, 100)
const port = 42000 + randomInt(1, 1000)
app.listen(port, () => res(port))
})
}

View File

@ -22,7 +22,7 @@ export class MockJoinPeerTubeVersions {
})
})
const port = 42201 + randomInt(1, 100)
const port = 43000 + randomInt(1, 1000)
app.listen(port, () => res(port))
})
}

View File

@ -32,7 +32,7 @@ export class MockObjectStorage {
)
})
const port = 42301 + randomInt(1, 100)
const port = 44000 + randomInt(1, 1000)
this.server = app.listen(port, () => res(port))
})
}

View File

@ -23,7 +23,7 @@ export class MockBlocklist {
return res.json(this.body)
})
const port = 42201 + randomInt(1, 100)
const port = 45000 + randomInt(1, 1000)
this.server = app.listen(port, () => res(port))
})
}

View File

@ -9,7 +9,7 @@ class MockProxy {
initialize () {
return new Promise<number>(res => {
const port = 42501 + randomInt(1, 100)
const port = 46000 + randomInt(1, 1000)
this.server = proxy(createServer())
this.server.listen(port, () => res(port))