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,
+ VideoStreamingPlaylistType
+} from '@shared/models'
import {
- checkLiveCleanupAfterSave,
- checkLiveSegmentHash,
- checkResolutionsInMasterPlaylist,
cleanupTests,
createMultipleServers,
doubleFollow,
setDefaultVideoChannel,
stopFfmpeg,
testFfmpegStreamError,
- testImage,
- wait,
waitJobs,
waitUntilLivePublishedOnAllServers
-} from '@shared/extra-utils'
-import {
- HttpStatusCode,
- LiveVideo,
- LiveVideoCreate,
- VideoDetails,
- VideoPrivacy,
- VideoState,
- VideoStreamingPlaylistType
-} from '@shared/models'
+} from '@shared/server-commands'
const expect = chai.expect
live: {
enabled: true,
allowReplay: true,
+ latencySetting: {
+ enabled: true
+ },
transcoding: {
enabled: false
}
commentsEnabled: false,
downloadEnabled: false,
saveReplay: true,
+ latencyMode: LiveVideoLatencyMode.SMALL_LATENCY,
privacy: VideoPrivacy.PUBLIC,
previewfile: 'video_short1-preview.webm.jpg',
thumbnailfile: 'video_short1.webm.jpg'
}
expect(live.saveReplay).to.be.true
+ expect(live.latencyMode).to.equal(LiveVideoLatencyMode.SMALL_LATENCY)
}
})
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)
})
}
expect(live.saveReplay).to.be.false
+ expect(live.latencyMode).to.equal(LiveVideoLatencyMode.DEFAULT)
}
})
transcoding: {
enabled: true,
resolutions: {
+ '144p': resolutions.includes(144),
'240p': resolutions.includes(240),
'360p': resolutions.includes(360),
'480p': resolutions.includes(480),
})
it('Should enable transcoding with some resolutions and correctly save them', async function () {
- this.timeout(200000)
+ this.timeout(400_000)
const resolutions = [ 240, 360, 720 ]
await waitUntilLivePublishedOnAllServers(servers, liveVideoId)
- const bitrateLimits = {
- 720: 5000 * 1000, // 60FPS
- 360: 1100 * 1000,
- 240: 600 * 1000
+ const maxBitrateLimits = {
+ 720: 6500 * 1000, // 60FPS
+ 360: 1250 * 1000,
+ 240: 700 * 1000
+ }
+
+ const minBitrateLimits = {
+ 720: 5500 * 1000,
+ 360: 1000 * 1000,
+ 240: 550 * 1000
}
for (const server of servers) {
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(bitrateLimits[videoStream.height])
+ expect(probe.format.bit_rate).to.be.below(maxBitrateLimits[videoStream.height])
+ expect(probe.format.bit_rate).to.be.at.least(minBitrateLimits[videoStream.height])
await makeRawRequest(file.torrentUrl, HttpStatusCode.OK_200)
await makeRawRequest(file.fileUrl, HttpStatusCode.OK_200)