diff options
Diffstat (limited to 'server/lib/live-manager.ts')
-rw-r--r-- | server/lib/live-manager.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.ts index e115d2d50..2d8f906e9 100644 --- a/server/lib/live-manager.ts +++ b/server/lib/live-manager.ts | |||
@@ -133,10 +133,8 @@ class LiveManager { | |||
133 | const sessionId = this.videoSessions.get(videoId) | 133 | const sessionId = this.videoSessions.get(videoId) |
134 | if (!sessionId) return | 134 | if (!sessionId) return |
135 | 135 | ||
136 | this.videoSessions.delete(videoId) | ||
136 | this.abortSession(sessionId) | 137 | this.abortSession(sessionId) |
137 | |||
138 | this.onEndTransmuxing(videoId, true) | ||
139 | .catch(err => logger.error('Cannot end transmuxing of video %d.', videoId, { err })) | ||
140 | } | 138 | } |
141 | 139 | ||
142 | private getContext () { | 140 | private getContext () { |
@@ -259,9 +257,12 @@ class LiveManager { | |||
259 | updateSegment(segmentPath) | 257 | updateSegment(segmentPath) |
260 | 258 | ||
261 | if (this.isDurationConstraintValid(startStreamDateTime) !== true) { | 259 | if (this.isDurationConstraintValid(startStreamDateTime) !== true) { |
260 | logger.info('Stopping session of %s: max duration exceeded.', videoUUID) | ||
261 | |||
262 | this.stopSessionOf(videoLive.videoId) | 262 | this.stopSessionOf(videoLive.videoId) |
263 | } | 263 | } |
264 | 264 | ||
265 | // Check user quota if the user enabled replay saving | ||
265 | if (videoLive.saveReplay === true) { | 266 | if (videoLive.saveReplay === true) { |
266 | stat(segmentPath) | 267 | stat(segmentPath) |
267 | .then(segmentStat => { | 268 | .then(segmentStat => { |
@@ -270,6 +271,8 @@ class LiveManager { | |||
270 | .then(() => this.isQuotaConstraintValid(user, videoLive)) | 271 | .then(() => this.isQuotaConstraintValid(user, videoLive)) |
271 | .then(quotaValid => { | 272 | .then(quotaValid => { |
272 | if (quotaValid !== true) { | 273 | if (quotaValid !== true) { |
274 | logger.info('Stopping session of %s: user quota exceeded.', videoUUID) | ||
275 | |||
273 | this.stopSessionOf(videoLive.videoId) | 276 | this.stopSessionOf(videoLive.videoId) |
274 | } | 277 | } |
275 | }) | 278 | }) |
@@ -319,7 +322,7 @@ class LiveManager { | |||
319 | onFFmpegEnded() | 322 | onFFmpegEnded() |
320 | 323 | ||
321 | // Don't care that we killed the ffmpeg process | 324 | // Don't care that we killed the ffmpeg process |
322 | if (err?.message?.includes('SIGINT')) return | 325 | if (err?.message?.includes('Exiting normally')) return |
323 | 326 | ||
324 | logger.error('Live transcoding error.', { err, stdout, stderr }) | 327 | logger.error('Live transcoding error.', { err, stdout, stderr }) |
325 | 328 | ||
@@ -348,8 +351,7 @@ class LiveManager { | |||
348 | } | 351 | } |
349 | }, { delay: cleanupNow ? 0 : VIDEO_LIVE.CLEANUP_DELAY }) | 352 | }, { delay: cleanupNow ? 0 : VIDEO_LIVE.CLEANUP_DELAY }) |
350 | 353 | ||
351 | // FIXME: use end | 354 | fullVideo.state = VideoState.LIVE_ENDED |
352 | fullVideo.state = VideoState.WAITING_FOR_LIVE | ||
353 | await fullVideo.save() | 355 | await fullVideo.save() |
354 | 356 | ||
355 | PeerTubeSocket.Instance.sendVideoLiveNewState(fullVideo) | 357 | PeerTubeSocket.Instance.sendVideoLiveNewState(fullVideo) |