diff options
author | Chocobozzz <me@florianbigard.com> | 2020-10-29 14:19:38 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-09 15:33:04 +0100 |
commit | 284ef529113ad61de30ff30a28c699b97d9ca02f (patch) | |
tree | 422224e25e9f6cba62d8edb68be0ae2d7adeb49f /server | |
parent | a056ca4813c82f490dcd31ac97a64d6bf76d3dcc (diff) | |
download | PeerTube-284ef529113ad61de30ff30a28c699b97d9ca02f.tar.gz PeerTube-284ef529113ad61de30ff30a28c699b97d9ca02f.tar.zst PeerTube-284ef529113ad61de30ff30a28c699b97d9ca02f.zip |
Fix live ending
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/live-manager.ts | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.ts index 692c49008..fd9a859f9 100644 --- a/server/lib/live-manager.ts +++ b/server/lib/live-manager.ts | |||
@@ -84,7 +84,7 @@ class LiveManager { | |||
84 | }) | 84 | }) |
85 | 85 | ||
86 | events.on('donePublish', sessionId => { | 86 | events.on('donePublish', sessionId => { |
87 | this.abortSession(sessionId) | 87 | logger.info('Live session ended.', { sessionId }) |
88 | }) | 88 | }) |
89 | 89 | ||
90 | this.segmentsSha256Queue = queue<SegmentSha256QueueParam, Error>((options, cb) => { | 90 | this.segmentsSha256Queue = queue<SegmentSha256QueueParam, Error>((options, cb) => { |
@@ -145,10 +145,16 @@ class LiveManager { | |||
145 | 145 | ||
146 | private abortSession (id: string) { | 146 | private abortSession (id: string) { |
147 | const session = this.getContext().sessions.get(id) | 147 | const session = this.getContext().sessions.get(id) |
148 | if (session) session.stop() | 148 | if (session) { |
149 | session.stop() | ||
150 | this.getContext().sessions.delete(id) | ||
151 | } | ||
149 | 152 | ||
150 | const transSession = this.transSessions.get(id) | 153 | const transSession = this.transSessions.get(id) |
151 | if (transSession) transSession.kill('SIGKILL') | 154 | if (transSession) { |
155 | transSession.kill('SIGINT') | ||
156 | this.transSessions.delete(id) | ||
157 | } | ||
152 | } | 158 | } |
153 | 159 | ||
154 | private async handleSession (sessionId: string, streamPath: string, streamKey: string) { | 160 | private async handleSession (sessionId: string, streamPath: string, streamKey: string) { |
@@ -300,6 +306,8 @@ class LiveManager { | |||
300 | const onFFmpegEnded = () => { | 306 | const onFFmpegEnded = () => { |
301 | logger.info('RTMP transmuxing for video %s ended. Scheduling cleanup', streamPath) | 307 | logger.info('RTMP transmuxing for video %s ended. Scheduling cleanup', streamPath) |
302 | 308 | ||
309 | this.transSessions.delete(sessionId) | ||
310 | |||
303 | Promise.all([ tsWatcher.close(), masterWatcher.close() ]) | 311 | Promise.all([ tsWatcher.close(), masterWatcher.close() ]) |
304 | .catch(err => logger.error('Cannot close watchers of %s.', outPath, { err })) | 312 | .catch(err => logger.error('Cannot close watchers of %s.', outPath, { err })) |
305 | 313 | ||
@@ -311,7 +319,7 @@ class LiveManager { | |||
311 | onFFmpegEnded() | 319 | onFFmpegEnded() |
312 | 320 | ||
313 | // Don't care that we killed the ffmpeg process | 321 | // Don't care that we killed the ffmpeg process |
314 | if (err?.message?.includes('SIGKILL')) return | 322 | if (err?.message?.includes('SIGINT')) return |
315 | 323 | ||
316 | logger.error('Live transcoding error.', { err, stdout, stderr }) | 324 | logger.error('Live transcoding error.', { err, stdout, stderr }) |
317 | }) | 325 | }) |