aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/live/live.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/live/live.ts')
-rw-r--r--server/tests/api/live/live.ts22
1 files changed, 20 insertions, 2 deletions
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index ac91b6b08..e685be08e 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -3,10 +3,13 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { FfmpegCommand } from 'fluent-ffmpeg' 5import { FfmpegCommand } from 'fluent-ffmpeg'
6import { join } from 'path'
7import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils'
6import { getLiveNotificationSocket } from '@shared/extra-utils/socket/socket-io' 8import { getLiveNotificationSocket } from '@shared/extra-utils/socket/socket-io'
7import { LiveVideo, LiveVideoCreate, Video, VideoDetails, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models' 9import { LiveVideo, LiveVideoCreate, Video, VideoDetails, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models'
8import { 10import {
9 addVideoToBlacklist, 11 addVideoToBlacklist,
12 buildServerDirectory,
10 checkLiveCleanup, 13 checkLiveCleanup,
11 checkLiveSegmentHash, 14 checkLiveSegmentHash,
12 checkResolutionsInMasterPlaylist, 15 checkResolutionsInMasterPlaylist,
@@ -396,10 +399,11 @@ describe('Test live', function () {
396 this.timeout(60000) 399 this.timeout(60000)
397 400
398 const resolutions = [ 240, 360, 720 ] 401 const resolutions = [ 240, 360, 720 ]
402
399 await updateConf(resolutions) 403 await updateConf(resolutions)
400 liveVideoId = await createLiveWrapper(true) 404 liveVideoId = await createLiveWrapper(true)
401 405
402 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) 406 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId, 'video_short2.webm')
403 await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoId) 407 await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoId)
404 await waitJobs(servers) 408 await waitJobs(servers)
405 409
@@ -409,6 +413,12 @@ describe('Test live', function () {
409 413
410 await waitJobs(servers) 414 await waitJobs(servers)
411 415
416 const bitrateLimits = {
417 720: 2800 * 1000,
418 360: 780 * 1000,
419 240: 320 * 1000
420 }
421
412 for (const server of servers) { 422 for (const server of servers) {
413 const resVideo = await getVideo(server.url, liveVideoId) 423 const resVideo = await getVideo(server.url, liveVideoId)
414 const video: VideoDetails = resVideo.body 424 const video: VideoDetails = resVideo.body
@@ -424,9 +434,17 @@ describe('Test live', function () {
424 const file = hlsPlaylist.files.find(f => f.resolution.id === resolution) 434 const file = hlsPlaylist.files.find(f => f.resolution.id === resolution)
425 435
426 expect(file).to.exist 436 expect(file).to.exist
427 expect(file.fps).to.be.oneOf([ 24, 25 ]) 437 expect(file.fps).to.be.approximately(30, 5)
428 expect(file.size).to.be.greaterThan(1) 438 expect(file.size).to.be.greaterThan(1)
429 439
440 const filename = `${video.uuid}-${resolution}-fragmented.mp4`
441 const segmentPath = buildServerDirectory(servers[0], join('streaming-playlists', 'hls', video.uuid, filename))
442
443 const probe = await ffprobePromise(segmentPath)
444 const videoStream = await getVideoStreamFromFile(segmentPath, probe)
445 console.log(videoStream)
446 expect(probe.format.bit_rate).to.be.below(bitrateLimits[videoStream.height])
447
430 await makeRawRequest(file.torrentUrl, 200) 448 await makeRawRequest(file.torrentUrl, 200)
431 await makeRawRequest(file.fileUrl, 200) 449 await makeRawRequest(file.fileUrl, 200)
432 } 450 }