Fix live ending job that breaks new live session
This commit is contained in:
parent
bffee1d538
commit
cdd838168d
4 changed files with 20 additions and 8 deletions
|
@ -45,13 +45,13 @@ async function processVideoLiveEnding (job: Job) {
|
||||||
LiveSegmentShaStore.Instance.cleanupShaSegments(liveVideo.uuid)
|
LiveSegmentShaStore.Instance.cleanupShaSegments(liveVideo.uuid)
|
||||||
|
|
||||||
if (live.saveReplay !== true) {
|
if (live.saveReplay !== true) {
|
||||||
return cleanupLiveAndFederate({ live, video: liveVideo })
|
return cleanupLiveAndFederate({ live, video: liveVideo, streamingPlaylistId: payload.streamingPlaylistId })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (live.permanentLive) {
|
if (live.permanentLive) {
|
||||||
await saveReplayToExternalVideo({ liveVideo, liveSession, publishedAt: payload.publishedAt, replayDirectory: payload.replayDirectory })
|
await saveReplayToExternalVideo({ liveVideo, liveSession, publishedAt: payload.publishedAt, replayDirectory: payload.replayDirectory })
|
||||||
|
|
||||||
return cleanupLiveAndFederate({ live, video: liveVideo })
|
return cleanupLiveAndFederate({ live, video: liveVideo, streamingPlaylistId: payload.streamingPlaylistId })
|
||||||
}
|
}
|
||||||
|
|
||||||
return replaceLiveByReplay({ liveVideo, live, liveSession, replayDirectory: payload.replayDirectory })
|
return replaceLiveByReplay({ liveVideo, live, liveSession, replayDirectory: payload.replayDirectory })
|
||||||
|
@ -233,15 +233,18 @@ async function assignReplayFilesToVideo (options: {
|
||||||
async function cleanupLiveAndFederate (options: {
|
async function cleanupLiveAndFederate (options: {
|
||||||
live: MVideoLive
|
live: MVideoLive
|
||||||
video: MVideo
|
video: MVideo
|
||||||
|
streamingPlaylistId: number
|
||||||
}) {
|
}) {
|
||||||
const { live, video } = options
|
const { live, video, streamingPlaylistId } = options
|
||||||
|
|
||||||
const streamingPlaylist = await VideoStreamingPlaylistModel.loadHLSPlaylistByVideo(video.id)
|
const streamingPlaylist = await VideoStreamingPlaylistModel.loadWithVideo(streamingPlaylistId)
|
||||||
|
|
||||||
if (live.permanentLive) {
|
if (streamingPlaylist) {
|
||||||
await cleanupPermanentLive(video, streamingPlaylist)
|
if (live.permanentLive) {
|
||||||
} else {
|
await cleanupPermanentLive(video, streamingPlaylist)
|
||||||
await cleanupNormalLive(video, streamingPlaylist)
|
} else {
|
||||||
|
await cleanupNormalLive(video, streamingPlaylist)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -416,6 +416,7 @@ class LiveManager {
|
||||||
: undefined,
|
: undefined,
|
||||||
|
|
||||||
liveSessionId: liveSession.id,
|
liveSessionId: liveSession.id,
|
||||||
|
streamingPlaylistId: fullVideo.getHLSPlaylist()?.id,
|
||||||
|
|
||||||
publishedAt: fullVideo.publishedAt.toISOString()
|
publishedAt: fullVideo.publishedAt.toISOString()
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {
|
||||||
createMultipleServers,
|
createMultipleServers,
|
||||||
doubleFollow,
|
doubleFollow,
|
||||||
findExternalSavedVideo,
|
findExternalSavedVideo,
|
||||||
|
makeRawRequest,
|
||||||
PeerTubeServer,
|
PeerTubeServer,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
setDefaultVideoChannel,
|
setDefaultVideoChannel,
|
||||||
|
@ -457,6 +458,12 @@ describe('Save replay setting', function () {
|
||||||
// Streaming session #2
|
// Streaming session #2
|
||||||
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
|
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
|
||||||
await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
|
await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
|
||||||
|
|
||||||
|
await wait(5000)
|
||||||
|
const video = await servers[0].videos.get({ id: liveVideoUUID })
|
||||||
|
expect(video.streamingPlaylists).to.have.lengthOf(1)
|
||||||
|
await makeRawRequest(video.streamingPlaylists[0].playlistUrl)
|
||||||
|
|
||||||
await stopFfmpeg(ffmpegCommand)
|
await stopFfmpeg(ffmpegCommand)
|
||||||
await waitUntilLiveWaitingOnAllServers(servers, liveVideoUUID)
|
await waitUntilLiveWaitingOnAllServers(servers, liveVideoUUID)
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,7 @@ export interface VideoLiveEndingPayload {
|
||||||
videoId: number
|
videoId: number
|
||||||
publishedAt: string
|
publishedAt: string
|
||||||
liveSessionId: number
|
liveSessionId: number
|
||||||
|
streamingPlaylistId: number
|
||||||
|
|
||||||
replayDirectory?: string
|
replayDirectory?: string
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue