]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/live/live.ts
Add test for RTMP stream without audio
[github/Chocobozzz/PeerTube.git] / server / tests / api / live / live.ts
index f6ad5c82ec68ad15a063629b447aea1fa0bbb51a..c436f0f01546d05fefac4fdaa0439ddb7d2fcb60 100644 (file)
@@ -1,11 +1,10 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import 'mocha'
-import * as chai from 'chai'
+import { expect } from 'chai'
 import { basename, join } from 'path'
 import { ffprobePromise, getVideoStream } from '@server/helpers/ffmpeg'
-import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist, getAllFiles, testImage } from '@server/tests/shared'
-import { wait } from '@shared/core-utils'
+import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist, testImage } from '@server/tests/shared'
+import { getAllFiles, wait } from '@shared/core-utils'
 import {
   HttpStatusCode,
   LiveVideo,
@@ -33,8 +32,6 @@ import {
   waitUntilLivePublishedOnAllServers
 } from '@shared/server-commands'
 
-const expect = chai.expect
-
 describe('Test live', function () {
   let servers: PeerTubeServer[] = []
   let commands: LiveCommand[]
@@ -223,7 +220,7 @@ describe('Test live', function () {
     let vodVideoId: string
 
     before(async function () {
-      this.timeout(120000)
+      this.timeout(240000)
 
       vodVideoId = (await servers[0].videos.quickUpload({ name: 'vod video' })).uuid
 
@@ -457,6 +454,18 @@ describe('Test live', function () {
       await stopFfmpeg(ffmpegCommand)
     })
 
+    it('Should transcode audio only RTMP stream', async function () {
+      this.timeout(120000)
+
+      liveVideoId = await createLiveWrapper(false)
+
+      const ffmpegCommand = await commands[0].sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short_no_audio.mp4' })
+      await waitUntilLivePublishedOnAllServers(servers, liveVideoId)
+      await waitJobs(servers)
+
+      await stopFfmpeg(ffmpegCommand)
+    })
+
     it('Should enable transcoding with some resolutions', async function () {
       this.timeout(120000)
 
@@ -558,7 +567,7 @@ describe('Test live', function () {
           expect(file.size).to.be.greaterThan(1)
 
           if (resolution >= 720) {
-            expect(file.fps).to.be.approximately(60, 2)
+            expect(file.fps).to.be.approximately(60, 10)
           } else {
             expect(file.fps).to.be.approximately(30, 2)
           }
@@ -622,7 +631,7 @@ describe('Test live', function () {
     })
 
     it('Should only keep the original resolution if all resolutions are disabled', async function () {
-      this.timeout(400_000)
+      this.timeout(600_000)
 
       await updateConf([])
       liveVideoId = await createLiveWrapper(true)
@@ -673,7 +682,7 @@ describe('Test live', function () {
     }
 
     before(async function () {
-      this.timeout(300000)
+      this.timeout(600_000)
 
       liveVideoId = await createLiveWrapper({ saveReplay: false, permanent: false })
       liveVideoReplayId = await createLiveWrapper({ saveReplay: true, permanent: false })