aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-transcoder.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-11-10 14:25:33 +0100
committerChocobozzz <me@florianbigard.com>2021-11-10 14:25:33 +0100
commitd78b51aa4ed74bd2e6598b771fcff6391d7d9a3e (patch)
tree3d99cad8d7defde4bae179f1e32d56335dbf0fe2 /server/tests/api/videos/video-transcoder.ts
parent67eeec8b955339120ff5d3c8286fdf0715e6270c (diff)
downloadPeerTube-d78b51aa4ed74bd2e6598b771fcff6391d7d9a3e.tar.gz
PeerTube-d78b51aa4ed74bd2e6598b771fcff6391d7d9a3e.tar.zst
PeerTube-d78b51aa4ed74bd2e6598b771fcff6391d7d9a3e.zip
Fix tests
Diffstat (limited to 'server/tests/api/videos/video-transcoder.ts')
-rw-r--r--server/tests/api/videos/video-transcoder.ts12
1 files changed, 9 insertions, 3 deletions
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 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { omit } from 'lodash' 5import { omit } from 'lodash'
6import { getMaxBitrate } from '@shared/core-utils' 6import { getMaxBitrate, getMinLimitBitrate } from '@shared/core-utils'
7import { 7import {
8 buildAbsoluteFixturePath, 8 buildAbsoluteFixturePath,
9 cleanupTests, 9 cleanupTests,
@@ -583,7 +583,7 @@ describe('Test video transcoding', function () {
583 } 583 }
584 }) 584 })
585 585
586 it('Should not transcode to an higher bitrate than the original file', async function () { 586 it('Should not transcode to an higher bitrate than the original file but above our low limit', async function () {
587 this.timeout(160_000) 587 this.timeout(160_000)
588 588
589 const newConfig = { 589 const newConfig = {
@@ -622,7 +622,13 @@ describe('Test video transcoding', function () {
622 622
623 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) 623 const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl)
624 const bitrate = await getVideoFileBitrate(path) 624 const bitrate = await getVideoFileBitrate(path)
625 expect(bitrate, `${path} not below ${60_000}`).to.be.below(60_000) 625
626 const inputBitrate = 60_000
627 const limit = getMinLimitBitrate({ fps: 10, ratio: 1, resolution: r })
628 let belowValue = Math.max(inputBitrate, limit)
629 belowValue += belowValue * 0.20 // Apply 20% margin because bitrate control is not very precise
630
631 expect(bitrate, `${path} not below ${limit}`).to.be.below(belowValue)
626 } 632 }
627 }) 633 })
628 }) 634 })