diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-05 10:53:04 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-05-09 08:57:34 +0200 |
commit | e7d8e2b245491c0a8e008fb570037506d729ff04 (patch) | |
tree | d850a7f82cc02946f2e87b306d0b281cef5eb73d /server/tests | |
parent | dd3f99434cc3cb7226d33ffcd888c91d0ce150a9 (diff) | |
download | PeerTube-e7d8e2b245491c0a8e008fb570037506d729ff04.tar.gz PeerTube-e7d8e2b245491c0a8e008fb570037506d729ff04.tar.zst PeerTube-e7d8e2b245491c0a8e008fb570037506d729ff04.zip |
Fix audio transcoding copy
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/transcoding/transcoder.ts | 6 | ||||
-rw-r--r-- | server/tests/helpers/core-utils.ts | 6 | ||||
-rw-r--r-- | server/tests/peertube-runner/live-transcoding.ts | 2 | ||||
-rw-r--r-- | server/tests/peertube-runner/studio-transcoding.ts | 2 | ||||
-rw-r--r-- | server/tests/shared/generate.ts | 4 |
5 files changed, 10 insertions, 10 deletions
diff --git a/server/tests/api/transcoding/transcoder.ts b/server/tests/api/transcoding/transcoder.ts index fa78b58bb..8a0a7f6d2 100644 --- a/server/tests/api/transcoding/transcoder.ts +++ b/server/tests/api/transcoding/transcoder.ts | |||
@@ -3,7 +3,7 @@ | |||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { canDoQuickTranscode } from '@server/lib/transcoding/transcoding-quick-transcode' | 4 | import { canDoQuickTranscode } from '@server/lib/transcoding/transcoding-quick-transcode' |
5 | import { checkWebTorrentWorks, generateHighBitrateVideo, generateVideoWithFramerate } from '@server/tests/shared' | 5 | import { checkWebTorrentWorks, generateHighBitrateVideo, generateVideoWithFramerate } from '@server/tests/shared' |
6 | import { buildAbsoluteFixturePath, getAllFiles, getMaxBitrate, getMinLimitBitrate, omit } from '@shared/core-utils' | 6 | import { buildAbsoluteFixturePath, getAllFiles, getMaxTheoreticalBitrate, getMinTheoreticalBitrate, omit } from '@shared/core-utils' |
7 | import { | 7 | import { |
8 | ffprobePromise, | 8 | ffprobePromise, |
9 | getAudioStream, | 9 | getAudioStream, |
@@ -564,7 +564,7 @@ describe('Test video transcoding', function () { | |||
564 | 564 | ||
565 | expect(resolution).to.equal(resolution) | 565 | expect(resolution).to.equal(resolution) |
566 | 566 | ||
567 | const maxBitrate = getMaxBitrate({ ...dataResolution, fps }) | 567 | const maxBitrate = getMaxTheoreticalBitrate({ ...dataResolution, fps }) |
568 | expect(bitrate).to.be.below(maxBitrate) | 568 | expect(bitrate).to.be.below(maxBitrate) |
569 | } | 569 | } |
570 | } | 570 | } |
@@ -611,7 +611,7 @@ describe('Test video transcoding', function () { | |||
611 | const bitrate = await getVideoStreamBitrate(path) | 611 | const bitrate = await getVideoStreamBitrate(path) |
612 | 612 | ||
613 | const inputBitrate = 60_000 | 613 | const inputBitrate = 60_000 |
614 | const limit = getMinLimitBitrate({ fps: 10, ratio: 1, resolution: r }) | 614 | const limit = getMinTheoreticalBitrate({ fps: 10, ratio: 1, resolution: r }) |
615 | let belowValue = Math.max(inputBitrate, limit) | 615 | let belowValue = Math.max(inputBitrate, limit) |
616 | belowValue += belowValue * 0.20 // Apply 20% margin because bitrate control is not very precise | 616 | belowValue += belowValue * 0.20 // Apply 20% margin because bitrate control is not very precise |
617 | 617 | ||
diff --git a/server/tests/helpers/core-utils.ts b/server/tests/helpers/core-utils.ts index de6ba4f82..cd2f07e4a 100644 --- a/server/tests/helpers/core-utils.ts +++ b/server/tests/helpers/core-utils.ts | |||
@@ -3,7 +3,7 @@ | |||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { snakeCase } from 'lodash' | 4 | import { snakeCase } from 'lodash' |
5 | import validator from 'validator' | 5 | import validator from 'validator' |
6 | import { getAverageBitrate, getMaxBitrate } from '@shared/core-utils' | 6 | import { getAverageTheoreticalBitrate, getMaxTheoreticalBitrate } from '@shared/core-utils' |
7 | import { VideoResolution } from '@shared/models' | 7 | import { VideoResolution } from '@shared/models' |
8 | import { objectConverter, parseBytes, parseDurationToMs } from '../../helpers/core-utils' | 8 | import { objectConverter, parseBytes, parseDurationToMs } from '../../helpers/core-utils' |
9 | 9 | ||
@@ -128,7 +128,7 @@ describe('Bitrate', function () { | |||
128 | ] | 128 | ] |
129 | 129 | ||
130 | for (const test of tests) { | 130 | for (const test of tests) { |
131 | expect(getMaxBitrate(test)).to.be.above(test.min * 1000).and.below(test.max * 1000) | 131 | expect(getMaxTheoreticalBitrate(test)).to.be.above(test.min * 1000).and.below(test.max * 1000) |
132 | } | 132 | } |
133 | }) | 133 | }) |
134 | 134 | ||
@@ -144,7 +144,7 @@ describe('Bitrate', function () { | |||
144 | ] | 144 | ] |
145 | 145 | ||
146 | for (const test of tests) { | 146 | for (const test of tests) { |
147 | expect(getAverageBitrate(test)).to.be.above(test.min * 1000).and.below(test.max * 1000) | 147 | expect(getAverageTheoreticalBitrate(test)).to.be.above(test.min * 1000).and.below(test.max * 1000) |
148 | } | 148 | } |
149 | }) | 149 | }) |
150 | }) | 150 | }) |
diff --git a/server/tests/peertube-runner/live-transcoding.ts b/server/tests/peertube-runner/live-transcoding.ts index 1e94eabcd..31716d545 100644 --- a/server/tests/peertube-runner/live-transcoding.ts +++ b/server/tests/peertube-runner/live-transcoding.ts | |||
@@ -145,7 +145,7 @@ describe('Test Live transcoding in peertube-runner program', function () { | |||
145 | const registrationToken = await servers[0].runnerRegistrationTokens.getFirstRegistrationToken() | 145 | const registrationToken = await servers[0].runnerRegistrationTokens.getFirstRegistrationToken() |
146 | 146 | ||
147 | peertubeRunner = new PeerTubeRunnerProcess() | 147 | peertubeRunner = new PeerTubeRunnerProcess() |
148 | await peertubeRunner.runServer({ hideLogs: false }) | 148 | await peertubeRunner.runServer() |
149 | await peertubeRunner.registerPeerTubeInstance({ server: servers[0], registrationToken, runnerName: 'runner' }) | 149 | await peertubeRunner.registerPeerTubeInstance({ server: servers[0], registrationToken, runnerName: 'runner' }) |
150 | }) | 150 | }) |
151 | 151 | ||
diff --git a/server/tests/peertube-runner/studio-transcoding.ts b/server/tests/peertube-runner/studio-transcoding.ts index cca905e2f..204836c4d 100644 --- a/server/tests/peertube-runner/studio-transcoding.ts +++ b/server/tests/peertube-runner/studio-transcoding.ts | |||
@@ -75,7 +75,7 @@ describe('Test studio transcoding in peertube-runner program', function () { | |||
75 | const registrationToken = await servers[0].runnerRegistrationTokens.getFirstRegistrationToken() | 75 | const registrationToken = await servers[0].runnerRegistrationTokens.getFirstRegistrationToken() |
76 | 76 | ||
77 | peertubeRunner = new PeerTubeRunnerProcess() | 77 | peertubeRunner = new PeerTubeRunnerProcess() |
78 | await peertubeRunner.runServer({ hideLogs: false }) | 78 | await peertubeRunner.runServer() |
79 | await peertubeRunner.registerPeerTubeInstance({ server: servers[0], registrationToken, runnerName: 'runner' }) | 79 | await peertubeRunner.registerPeerTubeInstance({ server: servers[0], registrationToken, runnerName: 'runner' }) |
80 | }) | 80 | }) |
81 | 81 | ||
diff --git a/server/tests/shared/generate.ts b/server/tests/shared/generate.ts index b0c8dba66..3788b049f 100644 --- a/server/tests/shared/generate.ts +++ b/server/tests/shared/generate.ts | |||
@@ -2,7 +2,7 @@ import { expect } from 'chai' | |||
2 | import ffmpeg from 'fluent-ffmpeg' | 2 | import ffmpeg from 'fluent-ffmpeg' |
3 | import { ensureDir, pathExists } from 'fs-extra' | 3 | import { ensureDir, pathExists } from 'fs-extra' |
4 | import { dirname } from 'path' | 4 | import { dirname } from 'path' |
5 | import { buildAbsoluteFixturePath, getMaxBitrate } from '@shared/core-utils' | 5 | import { buildAbsoluteFixturePath, getMaxTheoreticalBitrate } from '@shared/core-utils' |
6 | import { getVideoStreamBitrate, getVideoStreamDimensionsInfo, getVideoStreamFPS } from '@shared/ffmpeg' | 6 | import { getVideoStreamBitrate, getVideoStreamDimensionsInfo, getVideoStreamFPS } from '@shared/ffmpeg' |
7 | 7 | ||
8 | async function ensureHasTooBigBitrate (fixturePath: string) { | 8 | async function ensureHasTooBigBitrate (fixturePath: string) { |
@@ -10,7 +10,7 @@ async function ensureHasTooBigBitrate (fixturePath: string) { | |||
10 | const dataResolution = await getVideoStreamDimensionsInfo(fixturePath) | 10 | const dataResolution = await getVideoStreamDimensionsInfo(fixturePath) |
11 | const fps = await getVideoStreamFPS(fixturePath) | 11 | const fps = await getVideoStreamFPS(fixturePath) |
12 | 12 | ||
13 | const maxBitrate = getMaxBitrate({ ...dataResolution, fps }) | 13 | const maxBitrate = getMaxTheoreticalBitrate({ ...dataResolution, fps }) |
14 | expect(bitrate).to.be.above(maxBitrate) | 14 | expect(bitrate).to.be.above(maxBitrate) |
15 | } | 15 | } |
16 | 16 | ||