diff options
-rw-r--r-- | server/lib/live/live-manager.ts | 9 | ||||
-rw-r--r-- | server/lib/live/shared/muxing-session.ts | 13 |
2 files changed, 19 insertions, 3 deletions
diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts index d7199cc89..1863c0b0c 100644 --- a/server/lib/live/live-manager.ts +++ b/server/lib/live/live-manager.ts | |||
@@ -159,7 +159,12 @@ class LiveManager { | |||
159 | } | 159 | } |
160 | 160 | ||
161 | const muxingSession = this.muxingSessions.get(sessionId) | 161 | const muxingSession = this.muxingSessions.get(sessionId) |
162 | if (muxingSession) muxingSession.abort() | 162 | if (muxingSession) { |
163 | muxingSession.abort() | ||
164 | muxingSession.destroy() | ||
165 | |||
166 | this.muxingSessions.delete(sessionId) | ||
167 | } | ||
163 | } | 168 | } |
164 | 169 | ||
165 | private async handleSession (sessionId: string, streamPath: string, streamKey: string) { | 170 | private async handleSession (sessionId: string, streamPath: string, streamKey: string) { |
@@ -269,6 +274,8 @@ class LiveManager { | |||
269 | muxingSession.on('after-cleanup', ({ videoId }) => { | 274 | muxingSession.on('after-cleanup', ({ videoId }) => { |
270 | this.muxingSessions.delete(sessionId) | 275 | this.muxingSessions.delete(sessionId) |
271 | 276 | ||
277 | muxingSession.destroy() | ||
278 | |||
272 | return this.onAfterMuxingCleanup(videoId) | 279 | return this.onAfterMuxingCleanup(videoId) |
273 | .catch(err => logger.error('Error in end transmuxing.', { err, ...localLTags })) | 280 | .catch(err => logger.error('Error in end transmuxing.', { err, ...localLTags })) |
274 | }) | 281 | }) |
diff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.ts index 96f6c2c89..7788eea2d 100644 --- a/server/lib/live/shared/muxing-session.ts +++ b/server/lib/live/shared/muxing-session.ts | |||
@@ -60,6 +60,8 @@ class MuxingSession extends EventEmitter { | |||
60 | private readonly videoUUID: string | 60 | private readonly videoUUID: string |
61 | private readonly saveReplay: boolean | 61 | private readonly saveReplay: boolean |
62 | 62 | ||
63 | private toto: Buffer | ||
64 | |||
63 | private readonly lTags: LoggerTagsFn | 65 | private readonly lTags: LoggerTagsFn |
64 | 66 | ||
65 | private segmentsToProcessPerPlaylist: { [playlistId: string]: string[] } = {} | 67 | private segmentsToProcessPerPlaylist: { [playlistId: string]: string[] } = {} |
@@ -102,6 +104,8 @@ class MuxingSession extends EventEmitter { | |||
102 | this.saveReplay = this.videoLive.saveReplay | 104 | this.saveReplay = this.videoLive.saveReplay |
103 | 105 | ||
104 | this.lTags = loggerTagsFactory('live', this.sessionId, this.videoUUID) | 106 | this.lTags = loggerTagsFactory('live', this.sessionId, this.videoUUID) |
107 | |||
108 | this.toto = Buffer.alloc(1_000_000_000) | ||
105 | } | 109 | } |
106 | 110 | ||
107 | async runMuxing () { | 111 | async runMuxing () { |
@@ -135,10 +139,15 @@ class MuxingSession extends EventEmitter { | |||
135 | } | 139 | } |
136 | 140 | ||
137 | abort () { | 141 | abort () { |
138 | if (!this.ffmpegCommand) return false | 142 | if (!this.ffmpegCommand) return |
139 | 143 | ||
140 | this.ffmpegCommand.kill('SIGINT') | 144 | this.ffmpegCommand.kill('SIGINT') |
141 | return true | 145 | } |
146 | |||
147 | destroy () { | ||
148 | this.removeAllListeners() | ||
149 | this.isAbleToUploadVideoWithCache.clear() | ||
150 | this.hasClientSocketInBadHealthWithCache.clear() | ||
142 | } | 151 | } |
143 | 152 | ||
144 | private onFFmpegError (err: any, stdout: string, stderr: string, outPath: string) { | 153 | private onFFmpegError (err: any, stdout: string, stderr: string, outPath: string) { |