mirror of https://github.com/Chocobozzz/PeerTube
Correctly wait for live segment generation
parent
c106db1413
commit
81f14b9112
|
@ -153,7 +153,7 @@ describe('Save replay setting', function () {
|
||||||
let sessionEndDateMin: Date
|
let sessionEndDateMin: Date
|
||||||
|
|
||||||
it('Should correctly create and federate the "waiting for stream" live', async function () {
|
it('Should correctly create and federate the "waiting for stream" live', async function () {
|
||||||
this.timeout(20000)
|
this.timeout(40000)
|
||||||
|
|
||||||
liveVideoUUID = await createLiveWrapper({ permanent: false, replay: false })
|
liveVideoUUID = await createLiveWrapper({ permanent: false, replay: false })
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ describe('Save replay setting', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should correctly have updated the live and federated it when streaming in the live', async function () {
|
it('Should correctly have updated the live and federated it when streaming in the live', async function () {
|
||||||
this.timeout(30000)
|
this.timeout(40000)
|
||||||
|
|
||||||
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
|
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ describe('Save replay setting', function () {
|
||||||
describe('With save replay enabled on non permanent live', function () {
|
describe('With save replay enabled on non permanent live', function () {
|
||||||
|
|
||||||
it('Should correctly create and federate the "waiting for stream" live', async function () {
|
it('Should correctly create and federate the "waiting for stream" live', async function () {
|
||||||
this.timeout(20000)
|
this.timeout(40000)
|
||||||
|
|
||||||
liveVideoUUID = await createLiveWrapper({ permanent: false, replay: true, replaySettings: { privacy: VideoPrivacy.UNLISTED } })
|
liveVideoUUID = await createLiveWrapper({ permanent: false, replay: true, replaySettings: { privacy: VideoPrivacy.UNLISTED } })
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ describe('Save replay setting', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should correctly have updated the live and federated it when streaming in the live', async function () {
|
it('Should correctly have updated the live and federated it when streaming in the live', async function () {
|
||||||
this.timeout(20000)
|
this.timeout(40000)
|
||||||
|
|
||||||
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
|
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
|
||||||
await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
|
await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
|
||||||
|
@ -278,7 +278,7 @@ describe('Save replay setting', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should correctly have saved the live and federated it after the streaming', async function () {
|
it('Should correctly have saved the live and federated it after the streaming', async function () {
|
||||||
this.timeout(30000)
|
this.timeout(40000)
|
||||||
|
|
||||||
const session = await servers[0].live.findLatestSession({ videoId: liveVideoUUID })
|
const session = await servers[0].live.findLatestSession({ videoId: liveVideoUUID })
|
||||||
expect(session.endDate).to.not.exist
|
expect(session.endDate).to.not.exist
|
||||||
|
@ -319,7 +319,7 @@ describe('Save replay setting', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should update the saved live and correctly federate the updated attributes', async function () {
|
it('Should update the saved live and correctly federate the updated attributes', async function () {
|
||||||
this.timeout(30000)
|
this.timeout(40000)
|
||||||
|
|
||||||
await servers[0].videos.update({ id: liveVideoUUID, attributes: { name: 'video updated', privacy: VideoPrivacy.PUBLIC } })
|
await servers[0].videos.update({ id: liveVideoUUID, attributes: { name: 'video updated', privacy: VideoPrivacy.PUBLIC } })
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
@ -367,7 +367,7 @@ describe('Save replay setting', function () {
|
||||||
describe('With a first live and its replay', function () {
|
describe('With a first live and its replay', function () {
|
||||||
|
|
||||||
it('Should correctly create and federate the "waiting for stream" live', async function () {
|
it('Should correctly create and federate the "waiting for stream" live', async function () {
|
||||||
this.timeout(20000)
|
this.timeout(40000)
|
||||||
|
|
||||||
liveVideoUUID = await createLiveWrapper({ permanent: true, replay: true, replaySettings: { privacy: VideoPrivacy.UNLISTED } })
|
liveVideoUUID = await createLiveWrapper({ permanent: true, replay: true, replaySettings: { privacy: VideoPrivacy.UNLISTED } })
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ describe('Save replay setting', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should correctly have updated the live and federated it when streaming in the live', async function () {
|
it('Should correctly have updated the live and federated it when streaming in the live', async function () {
|
||||||
this.timeout(20000)
|
this.timeout(40000)
|
||||||
|
|
||||||
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
|
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
|
||||||
await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
|
await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
|
||||||
|
@ -392,7 +392,7 @@ describe('Save replay setting', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should correctly have saved the live and federated it after the streaming', async function () {
|
it('Should correctly have saved the live and federated it after the streaming', async function () {
|
||||||
this.timeout(30000)
|
this.timeout(40000)
|
||||||
|
|
||||||
const liveDetails = await servers[0].videos.get({ id: liveVideoUUID })
|
const liveDetails = await servers[0].videos.get({ id: liveVideoUUID })
|
||||||
|
|
||||||
|
@ -443,10 +443,11 @@ describe('Save replay setting', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('With a second live and its replay', function () {
|
describe('With a second live and its replay', function () {
|
||||||
|
|
||||||
it('Should update the replay settings', async function () {
|
it('Should update the replay settings', async function () {
|
||||||
await servers[0].live.update(
|
await servers[0].live.update({ videoId: liveVideoUUID, fields: { replaySettings: { privacy: VideoPrivacy.PUBLIC } } })
|
||||||
{ videoId: liveVideoUUID, fields: { replaySettings: { privacy: VideoPrivacy.PUBLIC } } })
|
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
|
||||||
const live = await servers[0].live.get({ videoId: liveVideoUUID })
|
const live = await servers[0].live.get({ videoId: liveVideoUUID })
|
||||||
|
|
||||||
expect(live.saveReplay).to.be.true
|
expect(live.saveReplay).to.be.true
|
||||||
|
@ -456,7 +457,7 @@ describe('Save replay setting', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should correctly have updated the live and federated it when streaming in the live', async function () {
|
it('Should correctly have updated the live and federated it when streaming in the live', async function () {
|
||||||
this.timeout(20000)
|
this.timeout(40000)
|
||||||
|
|
||||||
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
|
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
|
||||||
await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
|
await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
|
||||||
|
@ -469,7 +470,8 @@ describe('Save replay setting', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should correctly have saved the live and federated it after the streaming', async function () {
|
it('Should correctly have saved the live and federated it after the streaming', async function () {
|
||||||
this.timeout(30000)
|
this.timeout(40000)
|
||||||
|
|
||||||
const liveDetails = await servers[0].videos.get({ id: liveVideoUUID })
|
const liveDetails = await servers[0].videos.get({ id: liveVideoUUID })
|
||||||
|
|
||||||
await stopFfmpeg(ffmpegCommand)
|
await stopFfmpeg(ffmpegCommand)
|
||||||
|
|
|
@ -87,7 +87,7 @@ describe('Test bulk actions', function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
this.timeout(120000)
|
this.timeout(240000)
|
||||||
|
|
||||||
await servers[0].videos.upload({ attributes: { name: 'video 1 server 1' } })
|
await servers[0].videos.upload({ attributes: { name: 'video 1 server 1' } })
|
||||||
await servers[0].videos.upload({ attributes: { name: 'video 2 server 1' } })
|
await servers[0].videos.upload({ attributes: { name: 'video 2 server 1' } })
|
||||||
|
|
|
@ -33,7 +33,7 @@ describe('Test emails', function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
this.timeout(50000)
|
this.timeout(120000)
|
||||||
|
|
||||||
const emailPort = await MockSmtpServer.Instance.collectEmails(emails)
|
const emailPort = await MockSmtpServer.Instance.collectEmails(emails)
|
||||||
server = await createSingleServer(1, ConfigCommand.getEmailOverrideConfig(emailPort))
|
server = await createSingleServer(1, ConfigCommand.getEmailOverrideConfig(emailPort))
|
||||||
|
|
|
@ -282,7 +282,7 @@ describe('Test handle downs', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should upload many videos on server 1', async function () {
|
it('Should upload many videos on server 1', async function () {
|
||||||
this.timeout(120000)
|
this.timeout(240000)
|
||||||
|
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
const uuid = (await servers[0].videos.quickUpload({ name: 'video ' + i })).uuid
|
const uuid = (await servers[0].videos.quickUpload({ name: 'video ' + i })).uuid
|
||||||
|
|
|
@ -26,7 +26,7 @@ describe('Test services', function () {
|
||||||
]
|
]
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
this.timeout(30000)
|
this.timeout(120000)
|
||||||
|
|
||||||
server = await createSingleServer(1)
|
server = await createSingleServer(1)
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ describe('Test stats (excluding redundancy)', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should have the correct AP stats', async function () {
|
it('Should have the correct AP stats', async function () {
|
||||||
this.timeout(60000)
|
this.timeout(120000)
|
||||||
|
|
||||||
await servers[0].config.disableTranscoding()
|
await servers[0].config.disableTranscoding()
|
||||||
|
|
||||||
|
|
|
@ -213,6 +213,7 @@ export class LiveCommand extends AbstractCommand {
|
||||||
|
|
||||||
while (error) {
|
while (error) {
|
||||||
try {
|
try {
|
||||||
|
// Check fragment exists
|
||||||
await this.getRawRequest({
|
await this.getRawRequest({
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
|
@ -224,12 +225,16 @@ export class LiveCommand extends AbstractCommand {
|
||||||
const video = await server.videos.get({ id: videoUUID })
|
const video = await server.videos.get({ id: videoUUID })
|
||||||
const hlsPlaylist = video.streamingPlaylists[0]
|
const hlsPlaylist = video.streamingPlaylists[0]
|
||||||
|
|
||||||
|
// Check SHA generation
|
||||||
const shaBody = await server.streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url, withRetry: objectStorage })
|
const shaBody = await server.streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url, withRetry: objectStorage })
|
||||||
|
|
||||||
if (!shaBody[segmentName]) {
|
if (!shaBody[segmentName]) {
|
||||||
throw new Error('Segment SHA does not exist')
|
throw new Error('Segment SHA does not exist')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check fragment is in m3u8 playlist
|
||||||
|
const subPlaylist = await server.streamingPlaylists.get({ url: `${baseUrl}/${video.uuid}/${playlistNumber}.m3u8` })
|
||||||
|
if (!subPlaylist.includes(segmentName)) throw new Error('Fragment does not exist in playlist')
|
||||||
|
|
||||||
error = false
|
error = false
|
||||||
} catch {
|
} catch {
|
||||||
error = true
|
error = true
|
||||||
|
|
Loading…
Reference in New Issue