X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideo-transcoder.ts;h=7ed55b8e8d3d18b0fb2c3e2fe98c0169f723d9f9;hb=a37e9e74ff07b057370d1ed6c0b391a02be8a6d2;hp=b3226dbf7289f869c2fb22639b1d6cbfbb2f15cd;hpb=8dd754c76735417305c4b68e2ada6f623e9d7650;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index b3226dbf7..7ed55b8e8 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts @@ -3,7 +3,7 @@ import 'mocha' import * as chai from 'chai' import { omit } from 'lodash' -import { getMaxBitrate } from '@shared/core-utils' +import { getMaxBitrate, getMinLimitBitrate } from '@shared/core-utils' import { buildAbsoluteFixturePath, cleanupTests, @@ -583,7 +583,7 @@ describe('Test video transcoding', function () { } }) - it('Should not transcode to an higher bitrate than the original file', async function () { + it('Should not transcode to an higher bitrate than the original file but above our low limit', async function () { this.timeout(160_000) const newConfig = { @@ -622,7 +622,13 @@ describe('Test video transcoding', function () { const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) const bitrate = await getVideoFileBitrate(path) - expect(bitrate, `${path} not below ${60_000}`).to.be.below(60_000) + + const inputBitrate = 60_000 + const limit = getMinLimitBitrate({ fps: 10, ratio: 1, resolution: r }) + let belowValue = Math.max(inputBitrate, limit) + belowValue += belowValue * 0.20 // Apply 20% margin because bitrate control is not very precise + + expect(bitrate, `${path} not below ${limit}`).to.be.below(belowValue) } }) })