diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-12 09:18:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-10-12 09:18:54 +0200 |
commit | 9f430a53be016f8db2736d5d8111282660b50f4c (patch) | |
tree | 42be1b6a4b0c48f99a42f6462da2307f18d57bdc /server/tests/api | |
parent | 41085b1583ade5ea1bb1d69965a62b98cf012209 (diff) | |
download | PeerTube-9f430a53be016f8db2736d5d8111282660b50f4c.tar.gz PeerTube-9f430a53be016f8db2736d5d8111282660b50f4c.tar.zst PeerTube-9f430a53be016f8db2736d5d8111282660b50f4c.zip |
Fix bitrate tests
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/live/live.ts | 17 | ||||
-rw-r--r-- | server/tests/api/videos/video-transcoder.ts | 5 |
2 files changed, 14 insertions, 8 deletions
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index 5cac3bc4e..0b405dd94 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts | |||
@@ -517,10 +517,16 @@ describe('Test live', function () { | |||
517 | 517 | ||
518 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) | 518 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) |
519 | 519 | ||
520 | const bitrateLimits = { | 520 | const maxBitrateLimits = { |
521 | 720: 5000 * 1000, // 60FPS | 521 | 720: 6500 * 1000, // 60FPS |
522 | 360: 1100 * 1000, | 522 | 360: 1250 * 1000, |
523 | 240: 600 * 1000 | 523 | 240: 700 * 1000 |
524 | } | ||
525 | |||
526 | const minBitrateLimits = { | ||
527 | 720: 5500 * 1000, | ||
528 | 360: 1000 * 1000, | ||
529 | 240: 550 * 1000 | ||
524 | } | 530 | } |
525 | 531 | ||
526 | for (const server of servers) { | 532 | for (const server of servers) { |
@@ -560,7 +566,8 @@ describe('Test live', function () { | |||
560 | const probe = await ffprobePromise(segmentPath) | 566 | const probe = await ffprobePromise(segmentPath) |
561 | const videoStream = await getVideoStreamFromFile(segmentPath, probe) | 567 | const videoStream = await getVideoStreamFromFile(segmentPath, probe) |
562 | 568 | ||
563 | expect(probe.format.bit_rate).to.be.below(bitrateLimits[videoStream.height]) | 569 | expect(probe.format.bit_rate).to.be.below(maxBitrateLimits[videoStream.height]) |
570 | expect(probe.format.bit_rate).to.be.at.least(minBitrateLimits[videoStream.height]) | ||
564 | 571 | ||
565 | await makeRawRequest(file.torrentUrl, HttpStatusCode.OK_200) | 572 | await makeRawRequest(file.torrentUrl, HttpStatusCode.OK_200) |
566 | await makeRawRequest(file.fileUrl, HttpStatusCode.OK_200) | 573 | await makeRawRequest(file.fileUrl, HttpStatusCode.OK_200) |
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index 2b49176b2..21609fd82 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts | |||
@@ -11,7 +11,6 @@ import { | |||
11 | doubleFollow, | 11 | doubleFollow, |
12 | generateHighBitrateVideo, | 12 | generateHighBitrateVideo, |
13 | generateVideoWithFramerate, | 13 | generateVideoWithFramerate, |
14 | getFileSize, | ||
15 | makeGetRequest, | 14 | makeGetRequest, |
16 | PeerTubeServer, | 15 | PeerTubeServer, |
17 | setAccessTokensToServers, | 16 | setAccessTokensToServers, |
@@ -617,8 +616,8 @@ describe('Test video transcoding', function () { | |||
617 | const file = video.files.find(f => f.resolution.id === r) | 616 | const file = video.files.find(f => f.resolution.id === r) |
618 | 617 | ||
619 | const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) | 618 | const path = servers[1].servers.buildWebTorrentFilePath(file.fileUrl) |
620 | const size = await getFileSize(path) | 619 | const bitrate = await getVideoFileBitrate(path) |
621 | expect(size, `${path} not below ${60_000}`).to.be.below(60_000) | 620 | expect(bitrate, `${path} not below ${60_000}`).to.be.below(60_000) |
622 | } | 621 | } |
623 | }) | 622 | }) |
624 | }) | 623 | }) |