viewVideo,
wait,
waitJobs,
+ waitUntilLiveEnded,
+ waitUntilLivePublished,
waitUntilLiveStarts,
waitUntilLog
} from '../../../../shared/extra-utils'
})
it('Should enable transcoding with some resolutions and correctly save them', async function () {
- this.timeout(60000)
+ this.timeout(120000)
const resolutions = [ 240, 360, 720 ]
await testVideoResolutions(liveVideoId, resolutions)
await stopFfmpeg(command)
+ await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId)
await waitJobs(servers)
const bitrateLimits = {
- 720: 2800 * 1000,
- 360: 780 * 1000,
- 240: 320 * 1000
+ 720: 4000 * 1000, // 60FPS
+ 360: 1100 * 1000,
+ 240: 600 * 1000
}
for (const server of servers) {
expect(video.files).to.have.lengthOf(0)
const hlsPlaylist = video.streamingPlaylists.find(s => s.type === VideoStreamingPlaylistType.HLS)
+ await makeRawRequest(hlsPlaylist.playlistUrl, 200)
+ await makeRawRequest(hlsPlaylist.segmentsSha256Url, 200)
expect(hlsPlaylist.files).to.have.lengthOf(resolutions.length)
const file = hlsPlaylist.files.find(f => f.resolution.id === resolution)
expect(file).to.exist
- expect(file.fps).to.be.approximately(30, 5)
expect(file.size).to.be.greaterThan(1)
+ if (resolution >= 720) {
+ expect(file.fps).to.be.approximately(60, 2)
+ } else {
+ expect(file.fps).to.be.approximately(30, 2)
+ }
+
const filename = `${video.uuid}-${resolution}-fragmented.mp4`
const segmentPath = buildServerDirectory(servers[0], join('streaming-playlists', 'hls', video.uuid, filename))
const probe = await ffprobePromise(segmentPath)
const videoStream = await getVideoStreamFromFile(segmentPath, probe)
- console.log(videoStream)
+
expect(probe.format.bit_rate).to.be.below(bitrateLimits[videoStream.height])
await makeRawRequest(file.torrentUrl, 200)
}
const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
- await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID)
+
+ for (const server of servers) {
+ await waitUntilLiveStarts(server.url, server.accessToken, liveVideoUUID)
+ }
+
await waitJobs(servers)
for (const stateChanges of [ localStateChanges, remoteStateChanges ]) {
- expect(stateChanges).to.have.lengthOf(1)
- expect(stateChanges[0]).to.equal(VideoState.PUBLISHED)
+ expect(stateChanges).to.have.length.at.least(1)
+ expect(stateChanges[stateChanges.length - 1]).to.equal(VideoState.PUBLISHED)
}
await stopFfmpeg(command)
+
+ for (const server of servers) {
+ await waitUntilLiveEnded(server.url, server.accessToken, liveVideoUUID)
+ }
+
await waitJobs(servers)
for (const stateChanges of [ localStateChanges, remoteStateChanges ]) {
- expect(stateChanges).to.have.lengthOf(2)
- expect(stateChanges[1]).to.equal(VideoState.LIVE_ENDED)
+ expect(stateChanges).to.have.length.at.least(2)
+ expect(stateChanges[stateChanges.length - 1]).to.equal(VideoState.LIVE_ENDED)
}
})