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)
|
||||
|
||||
if (live.saveReplay !== true) {
|
||||
return cleanupLiveAndFederate({ live, video: liveVideo })
|
||||
return cleanupLiveAndFederate({ live, video: liveVideo, streamingPlaylistId: payload.streamingPlaylistId })
|
||||
}
|
||||
|
||||
if (live.permanentLive) {
|
||||
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 })
|
||||
|
@ -233,15 +233,18 @@ async function assignReplayFilesToVideo (options: {
|
|||
async function cleanupLiveAndFederate (options: {
|
||||
live: MVideoLive
|
||||
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) {
|
||||
await cleanupPermanentLive(video, streamingPlaylist)
|
||||
} else {
|
||||
await cleanupNormalLive(video, streamingPlaylist)
|
||||
if (streamingPlaylist) {
|
||||
if (live.permanentLive) {
|
||||
await cleanupPermanentLive(video, streamingPlaylist)
|
||||
} else {
|
||||
await cleanupNormalLive(video, streamingPlaylist)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -416,6 +416,7 @@ class LiveManager {
|
|||
: undefined,
|
||||
|
||||
liveSessionId: liveSession.id,
|
||||
streamingPlaylistId: fullVideo.getHLSPlaylist()?.id,
|
||||
|
||||
publishedAt: fullVideo.publishedAt.toISOString()
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
createMultipleServers,
|
||||
doubleFollow,
|
||||
findExternalSavedVideo,
|
||||
makeRawRequest,
|
||||
PeerTubeServer,
|
||||
setAccessTokensToServers,
|
||||
setDefaultVideoChannel,
|
||||
|
@ -457,6 +458,12 @@ describe('Save replay setting', function () {
|
|||
// Streaming session #2
|
||||
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: 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 waitUntilLiveWaitingOnAllServers(servers, liveVideoUUID)
|
||||
|
||||
|
|
|
@ -161,6 +161,7 @@ export interface VideoLiveEndingPayload {
|
|||
videoId: number
|
||||
publishedAt: string
|
||||
liveSessionId: number
|
||||
streamingPlaylistId: number
|
||||
|
||||
replayDirectory?: string
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue