})
events.on('donePublish', sessionId => {
- this.abortSession(sessionId)
+ logger.info('Live session ended.', { sessionId })
})
this.segmentsSha256Queue = queue<SegmentSha256QueueParam, Error>((options, cb) => {
private abortSession (id: string) {
const session = this.getContext().sessions.get(id)
- if (session) session.stop()
+ if (session) {
+ session.stop()
+ this.getContext().sessions.delete(id)
+ }
const transSession = this.transSessions.get(id)
- if (transSession) transSession.kill('SIGKILL')
+ if (transSession) {
+ transSession.kill('SIGINT')
+ this.transSessions.delete(id)
+ }
}
private async handleSession (sessionId: string, streamPath: string, streamKey: string) {
const onFFmpegEnded = () => {
logger.info('RTMP transmuxing for video %s ended. Scheduling cleanup', streamPath)
+ this.transSessions.delete(sessionId)
+
Promise.all([ tsWatcher.close(), masterWatcher.close() ])
.catch(err => logger.error('Cannot close watchers of %s.', outPath, { err }))
onFFmpegEnded()
// Don't care that we killed the ffmpeg process
- if (err?.message?.includes('SIGKILL')) return
+ if (err?.message?.includes('SIGINT')) return
logger.error('Live transcoding error.', { err, stdout, stderr })
})