diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-22 13:44:22 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-22 13:54:46 +0200 |
commit | 17ecdf61ce1d374cc8ba17601b93c9bda08112b2 (patch) | |
tree | d3405d11636f661815c3ad09821944a5ae26ebfa /server/lib | |
parent | f3bc1b541619673f14db7de220b9c520a4f35ca8 (diff) | |
download | PeerTube-17ecdf61ce1d374cc8ba17601b93c9bda08112b2.tar.gz PeerTube-17ecdf61ce1d374cc8ba17601b93c9bda08112b2.tar.zst PeerTube-17ecdf61ce1d374cc8ba17601b93c9bda08112b2.zip |
Force stop remote live transcoding
Diffstat (limited to 'server/lib')
5 files changed, 12 insertions, 1 deletions
diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts index 68aa18443..f062e2fd3 100644 --- a/server/lib/live/live-manager.ts +++ b/server/lib/live/live-manager.ts | |||
@@ -178,6 +178,10 @@ class LiveManager { | |||
178 | return !!this.rtmpServer | 178 | return !!this.rtmpServer |
179 | } | 179 | } |
180 | 180 | ||
181 | hasSession (sessionId: string) { | ||
182 | return this.getContext().sessions.has(sessionId) | ||
183 | } | ||
184 | |||
181 | stopSessionOf (videoUUID: string, error: LiveVideoError | null) { | 185 | stopSessionOf (videoUUID: string, error: LiveVideoError | null) { |
182 | const sessionId = this.videoSessions.get(videoUUID) | 186 | const sessionId = this.videoSessions.get(videoUUID) |
183 | if (!sessionId) { | 187 | if (!sessionId) { |
diff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.ts index 6632499ff..c672ec4d6 100644 --- a/server/lib/live/shared/muxing-session.ts +++ b/server/lib/live/shared/muxing-session.ts | |||
@@ -477,6 +477,7 @@ class MuxingSession extends EventEmitter { | |||
477 | 477 | ||
478 | lTags: this.lTags, | 478 | lTags: this.lTags, |
479 | 479 | ||
480 | sessionId: this.sessionId, | ||
480 | inputLocalUrl: this.inputLocalUrl, | 481 | inputLocalUrl: this.inputLocalUrl, |
481 | inputPublicUrl: this.inputPublicUrl, | 482 | inputPublicUrl: this.inputPublicUrl, |
482 | 483 | ||
diff --git a/server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.ts b/server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.ts index ee61d7690..95168745d 100644 --- a/server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.ts +++ b/server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.ts | |||
@@ -25,6 +25,7 @@ interface AbstractTranscodingWrapperOptions { | |||
25 | 25 | ||
26 | lTags: LoggerTagsFn | 26 | lTags: LoggerTagsFn |
27 | 27 | ||
28 | sessionId: string | ||
28 | inputLocalUrl: string | 29 | inputLocalUrl: string |
29 | inputPublicUrl: string | 30 | inputPublicUrl: string |
30 | 31 | ||
@@ -52,6 +53,7 @@ abstract class AbstractTranscodingWrapper extends EventEmitter { | |||
52 | fps: number | 53 | fps: number |
53 | }[] | 54 | }[] |
54 | 55 | ||
56 | protected readonly sessionId: string | ||
55 | protected readonly inputLocalUrl: string | 57 | protected readonly inputLocalUrl: string |
56 | protected readonly inputPublicUrl: string | 58 | protected readonly inputPublicUrl: string |
57 | 59 | ||
@@ -80,6 +82,7 @@ abstract class AbstractTranscodingWrapper extends EventEmitter { | |||
80 | this.videoUUID = options.videoLive.Video.uuid | 82 | this.videoUUID = options.videoLive.Video.uuid |
81 | this.streamingPlaylist = options.streamingPlaylist | 83 | this.streamingPlaylist = options.streamingPlaylist |
82 | 84 | ||
85 | this.sessionId = options.sessionId | ||
83 | this.inputLocalUrl = options.inputLocalUrl | 86 | this.inputLocalUrl = options.inputLocalUrl |
84 | this.inputPublicUrl = options.inputPublicUrl | 87 | this.inputPublicUrl = options.inputPublicUrl |
85 | 88 | ||
diff --git a/server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.ts b/server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.ts index 6770a5e6f..2aeeb31fb 100644 --- a/server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.ts +++ b/server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.ts | |||
@@ -5,6 +5,7 @@ export class RemoteTranscodingWrapper extends AbstractTranscodingWrapper { | |||
5 | async run () { | 5 | async run () { |
6 | await new LiveRTMPHLSTranscodingJobHandler().create({ | 6 | await new LiveRTMPHLSTranscodingJobHandler().create({ |
7 | rtmpUrl: this.inputPublicUrl, | 7 | rtmpUrl: this.inputPublicUrl, |
8 | sessionId: this.sessionId, | ||
8 | toTranscode: this.toTranscode, | 9 | toTranscode: this.toTranscode, |
9 | video: this.videoLive.Video, | 10 | video: this.videoLive.Video, |
10 | outputDirectory: this.outDirectory, | 11 | outputDirectory: this.outDirectory, |
diff --git a/server/lib/runners/job-handlers/live-rtmp-hls-transcoding-job-handler.ts b/server/lib/runners/job-handlers/live-rtmp-hls-transcoding-job-handler.ts index 87b6f0702..6b2894f8c 100644 --- a/server/lib/runners/job-handlers/live-rtmp-hls-transcoding-job-handler.ts +++ b/server/lib/runners/job-handlers/live-rtmp-hls-transcoding-job-handler.ts | |||
@@ -20,6 +20,7 @@ type CreateOptions = { | |||
20 | video: MVideo | 20 | video: MVideo |
21 | playlist: MStreamingPlaylist | 21 | playlist: MStreamingPlaylist |
22 | 22 | ||
23 | sessionId: string | ||
23 | rtmpUrl: string | 24 | rtmpUrl: string |
24 | 25 | ||
25 | toTranscode: { | 26 | toTranscode: { |
@@ -37,7 +38,7 @@ type CreateOptions = { | |||
37 | export class LiveRTMPHLSTranscodingJobHandler extends AbstractJobHandler<CreateOptions, LiveRTMPHLSTranscodingUpdatePayload, LiveRTMPHLSTranscodingSuccess> { | 38 | export class LiveRTMPHLSTranscodingJobHandler extends AbstractJobHandler<CreateOptions, LiveRTMPHLSTranscodingUpdatePayload, LiveRTMPHLSTranscodingSuccess> { |
38 | 39 | ||
39 | async create (options: CreateOptions) { | 40 | async create (options: CreateOptions) { |
40 | const { video, rtmpUrl, toTranscode, playlist, segmentDuration, segmentListSize, outputDirectory } = options | 41 | const { video, rtmpUrl, toTranscode, playlist, segmentDuration, segmentListSize, outputDirectory, sessionId } = options |
41 | 42 | ||
42 | const jobUUID = buildUUID() | 43 | const jobUUID = buildUUID() |
43 | const payload: RunnerJobLiveRTMPHLSTranscodingPayload = { | 44 | const payload: RunnerJobLiveRTMPHLSTranscodingPayload = { |
@@ -54,6 +55,7 @@ export class LiveRTMPHLSTranscodingJobHandler extends AbstractJobHandler<CreateO | |||
54 | const privatePayload: RunnerJobLiveRTMPHLSTranscodingPrivatePayload = { | 55 | const privatePayload: RunnerJobLiveRTMPHLSTranscodingPrivatePayload = { |
55 | videoUUID: video.uuid, | 56 | videoUUID: video.uuid, |
56 | masterPlaylistName: playlist.playlistFilename, | 57 | masterPlaylistName: playlist.playlistFilename, |
58 | sessionId, | ||
57 | outputDirectory | 59 | outputDirectory |
58 | } | 60 | } |
59 | 61 | ||