]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/live/live.ts
Merge remote-tracking branch 'weblate/develop' into develop
[github/Chocobozzz/PeerTube.git] / server / tests / api / live / live.ts
index 3f9355d2de6a3265ae696262e8843fd127408a3f..aeb0396969e9be5aeb2ed1bb1c2b2914671de6f9 100644 (file)
@@ -3,13 +3,14 @@
 import 'mocha'
 import * as chai from 'chai'
 import { basename, join } from 'path'
-import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils'
+import { ffprobePromise, getVideoStream } from '@server/helpers/ffmpeg'
 import { checkLiveCleanupAfterSave, checkLiveSegmentHash, checkResolutionsInMasterPlaylist, testImage } from '@server/tests/shared'
 import { wait } from '@shared/core-utils'
 import {
   HttpStatusCode,
   LiveVideo,
   LiveVideoCreate,
+  LiveVideoLatencyMode,
   VideoDetails,
   VideoPrivacy,
   VideoState,
@@ -52,6 +53,9 @@ describe('Test live', function () {
         live: {
           enabled: true,
           allowReplay: true,
+          latencySetting: {
+            enabled: true
+          },
           transcoding: {
             enabled: false
           }
@@ -85,6 +89,7 @@ describe('Test live', function () {
         commentsEnabled: false,
         downloadEnabled: false,
         saveReplay: true,
+        latencyMode: LiveVideoLatencyMode.SMALL_LATENCY,
         privacy: VideoPrivacy.PUBLIC,
         previewfile: 'video_short1-preview.webm.jpg',
         thumbnailfile: 'video_short1.webm.jpg'
@@ -131,6 +136,7 @@ describe('Test live', function () {
         }
 
         expect(live.saveReplay).to.be.true
+        expect(live.latencyMode).to.equal(LiveVideoLatencyMode.SMALL_LATENCY)
       }
     })
 
@@ -175,7 +181,7 @@ describe('Test live', function () {
     it('Should update the live', async function () {
       this.timeout(10000)
 
-      await commands[0].update({ videoId: liveVideoUUID, fields: { saveReplay: false } })
+      await commands[0].update({ videoId: liveVideoUUID, fields: { saveReplay: false, latencyMode: LiveVideoLatencyMode.DEFAULT } })
       await waitJobs(servers)
     })
 
@@ -192,6 +198,7 @@ describe('Test live', function () {
         }
 
         expect(live.saveReplay).to.be.false
+        expect(live.latencyMode).to.equal(LiveVideoLatencyMode.DEFAULT)
       }
     })
 
@@ -562,7 +569,7 @@ describe('Test live', function () {
           const segmentPath = servers[0].servers.buildDirectory(join('streaming-playlists', 'hls', video.uuid, filename))
 
           const probe = await ffprobePromise(segmentPath)
-          const videoStream = await getVideoStreamFromFile(segmentPath, probe)
+          const videoStream = await getVideoStream(segmentPath, probe)
 
           expect(probe.format.bit_rate).to.be.below(maxBitrateLimits[videoStream.height])
           expect(probe.format.bit_rate).to.be.at.least(minBitrateLimits[videoStream.height])