aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-06-16 14:11:31 +0200
committerChocobozzz <me@florianbigard.com>2022-06-16 14:11:31 +0200
commit0c9a83546687d2ae80b3f5299a8ee59d741f894f (patch)
treebd6d92679e6ed1fa93a89c4d028cd25891be935f /server
parent5b0ec7cddb1ae6dbd2057f067382866f846b882c (diff)
parentcdd838168d617f70fc04fe7f23846810e7e07082 (diff)
downloadPeerTube-0c9a83546687d2ae80b3f5299a8ee59d741f894f.tar.gz
PeerTube-0c9a83546687d2ae80b3f5299a8ee59d741f894f.tar.zst
PeerTube-0c9a83546687d2ae80b3f5299a8ee59d741f894f.zip
Merge branch 'release/4.2.0' into develop
Diffstat (limited to 'server')
-rw-r--r--server/lib/job-queue/handlers/video-live-ending.ts19
-rw-r--r--server/lib/live/live-manager.ts1
-rw-r--r--server/tests/api/live/live-save-replay.ts7
3 files changed, 19 insertions, 8 deletions
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts
index 7607267f8..feec257fc 100644
--- a/server/lib/job-queue/handlers/video-live-ending.ts
+++ b/server/lib/job-queue/handlers/video-live-ending.ts
@@ -45,13 +45,13 @@ async function processVideoLiveEnding (job: Job) {
45 LiveSegmentShaStore.Instance.cleanupShaSegments(liveVideo.uuid) 45 LiveSegmentShaStore.Instance.cleanupShaSegments(liveVideo.uuid)
46 46
47 if (live.saveReplay !== true) { 47 if (live.saveReplay !== true) {
48 return cleanupLiveAndFederate({ live, video: liveVideo }) 48 return cleanupLiveAndFederate({ live, video: liveVideo, streamingPlaylistId: payload.streamingPlaylistId })
49 } 49 }
50 50
51 if (live.permanentLive) { 51 if (live.permanentLive) {
52 await saveReplayToExternalVideo({ liveVideo, liveSession, publishedAt: payload.publishedAt, replayDirectory: payload.replayDirectory }) 52 await saveReplayToExternalVideo({ liveVideo, liveSession, publishedAt: payload.publishedAt, replayDirectory: payload.replayDirectory })
53 53
54 return cleanupLiveAndFederate({ live, video: liveVideo }) 54 return cleanupLiveAndFederate({ live, video: liveVideo, streamingPlaylistId: payload.streamingPlaylistId })
55 } 55 }
56 56
57 return replaceLiveByReplay({ liveVideo, live, liveSession, replayDirectory: payload.replayDirectory }) 57 return replaceLiveByReplay({ liveVideo, live, liveSession, replayDirectory: payload.replayDirectory })
@@ -233,15 +233,18 @@ async function assignReplayFilesToVideo (options: {
233async function cleanupLiveAndFederate (options: { 233async function cleanupLiveAndFederate (options: {
234 live: MVideoLive 234 live: MVideoLive
235 video: MVideo 235 video: MVideo
236 streamingPlaylistId: number
236}) { 237}) {
237 const { live, video } = options 238 const { live, video, streamingPlaylistId } = options
238 239
239 const streamingPlaylist = await VideoStreamingPlaylistModel.loadHLSPlaylistByVideo(video.id) 240 const streamingPlaylist = await VideoStreamingPlaylistModel.loadWithVideo(streamingPlaylistId)
240 241
241 if (live.permanentLive) { 242 if (streamingPlaylist) {
242 await cleanupPermanentLive(video, streamingPlaylist) 243 if (live.permanentLive) {
243 } else { 244 await cleanupPermanentLive(video, streamingPlaylist)
244 await cleanupNormalLive(video, streamingPlaylist) 245 } else {
246 await cleanupNormalLive(video, streamingPlaylist)
247 }
245 } 248 }
246 249
247 try { 250 try {
diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts
index 0f14a6851..f2f064b49 100644
--- a/server/lib/live/live-manager.ts
+++ b/server/lib/live/live-manager.ts
@@ -416,6 +416,7 @@ class LiveManager {
416 : undefined, 416 : undefined,
417 417
418 liveSessionId: liveSession.id, 418 liveSessionId: liveSession.id,
419 streamingPlaylistId: fullVideo.getHLSPlaylist()?.id,
419 420
420 publishedAt: fullVideo.publishedAt.toISOString() 421 publishedAt: fullVideo.publishedAt.toISOString()
421 } 422 }
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index 007af51e9..99d500711 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -12,6 +12,7 @@ import {
12 createMultipleServers, 12 createMultipleServers,
13 doubleFollow, 13 doubleFollow,
14 findExternalSavedVideo, 14 findExternalSavedVideo,
15 makeRawRequest,
15 PeerTubeServer, 16 PeerTubeServer,
16 setAccessTokensToServers, 17 setAccessTokensToServers,
17 setDefaultVideoChannel, 18 setDefaultVideoChannel,
@@ -457,6 +458,12 @@ describe('Save replay setting', function () {
457 // Streaming session #2 458 // Streaming session #2
458 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 459 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
459 await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) 460 await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
461
462 await wait(5000)
463 const video = await servers[0].videos.get({ id: liveVideoUUID })
464 expect(video.streamingPlaylists).to.have.lengthOf(1)
465 await makeRawRequest(video.streamingPlaylists[0].playlistUrl)
466
460 await stopFfmpeg(ffmpegCommand) 467 await stopFfmpeg(ffmpegCommand)
461 await waitUntilLiveWaitingOnAllServers(servers, liveVideoUUID) 468 await waitUntilLiveWaitingOnAllServers(servers, liveVideoUUID)
462 469