aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/live/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-16 09:12:50 +0200
committerChocobozzz <me@florianbigard.com>2023-05-16 09:12:50 +0200
commit287057050526e1f474c4f4d5d9a7ef3b7c677f2f (patch)
tree09fc9e4879617973b78534252ab601f4aeb9a242 /server/lib/live/shared
parentb30ad9888f54e6b55f3b6ca6e73534227d4d401e (diff)
downloadPeerTube-287057050526e1f474c4f4d5d9a7ef3b7c677f2f.tar.gz
PeerTube-287057050526e1f474c4f4d5d9a7ef3b7c677f2f.tar.zst
PeerTube-287057050526e1f474c4f4d5d9a7ef3b7c677f2f.zip
Provide public RTMP URL to runners
Diffstat (limited to 'server/lib/live/shared')
-rw-r--r--server/lib/live/shared/muxing-session.ts20
-rw-r--r--server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.ts12
-rw-r--r--server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts4
-rw-r--r--server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.ts2
4 files changed, 27 insertions, 11 deletions
diff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.ts
index 57e28aabf..6632499ff 100644
--- a/server/lib/live/shared/muxing-session.ts
+++ b/server/lib/live/shared/muxing-session.ts
@@ -62,7 +62,10 @@ class MuxingSession extends EventEmitter {
62 private readonly user: MUserId 62 private readonly user: MUserId
63 private readonly sessionId: string 63 private readonly sessionId: string
64 private readonly videoLive: MVideoLiveVideo 64 private readonly videoLive: MVideoLiveVideo
65 private readonly inputUrl: string 65
66 private readonly inputLocalUrl: string
67 private readonly inputPublicUrl: string
68
66 private readonly fps: number 69 private readonly fps: number
67 private readonly allResolutions: number[] 70 private readonly allResolutions: number[]
68 71
@@ -107,7 +110,10 @@ class MuxingSession extends EventEmitter {
107 user: MUserId 110 user: MUserId
108 sessionId: string 111 sessionId: string
109 videoLive: MVideoLiveVideo 112 videoLive: MVideoLiveVideo
110 inputUrl: string 113
114 inputLocalUrl: string
115 inputPublicUrl: string
116
111 fps: number 117 fps: number
112 bitrate: number 118 bitrate: number
113 ratio: number 119 ratio: number
@@ -120,7 +126,10 @@ class MuxingSession extends EventEmitter {
120 this.user = options.user 126 this.user = options.user
121 this.sessionId = options.sessionId 127 this.sessionId = options.sessionId
122 this.videoLive = options.videoLive 128 this.videoLive = options.videoLive
123 this.inputUrl = options.inputUrl 129
130 this.inputLocalUrl = options.inputLocalUrl
131 this.inputPublicUrl = options.inputPublicUrl
132
124 this.fps = options.fps 133 this.fps = options.fps
125 134
126 this.bitrate = options.bitrate 135 this.bitrate = options.bitrate
@@ -375,7 +384,7 @@ class MuxingSession extends EventEmitter {
375 private onTranscodedEnded () { 384 private onTranscodedEnded () {
376 this.emit('transcoding-end', ({ videoUUID: this.videoUUID })) 385 this.emit('transcoding-end', ({ videoUUID: this.videoUUID }))
377 386
378 logger.info('RTMP transmuxing for video %s ended. Scheduling cleanup', this.inputUrl, this.lTags()) 387 logger.info('RTMP transmuxing for video %s ended. Scheduling cleanup', this.inputLocalUrl, this.lTags())
379 388
380 setTimeout(() => { 389 setTimeout(() => {
381 // Wait latest segments generation, and close watchers 390 // Wait latest segments generation, and close watchers
@@ -468,7 +477,8 @@ class MuxingSession extends EventEmitter {
468 477
469 lTags: this.lTags, 478 lTags: this.lTags,
470 479
471 inputUrl: this.inputUrl, 480 inputLocalUrl: this.inputLocalUrl,
481 inputPublicUrl: this.inputPublicUrl,
472 482
473 toTranscode: this.allResolutions.map(resolution => ({ 483 toTranscode: this.allResolutions.map(resolution => ({
474 resolution, 484 resolution,
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 226ba4573..ee61d7690 100644
--- a/server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.ts
+++ b/server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.ts
@@ -25,7 +25,9 @@ interface AbstractTranscodingWrapperOptions {
25 25
26 lTags: LoggerTagsFn 26 lTags: LoggerTagsFn
27 27
28 inputUrl: string 28 inputLocalUrl: string
29 inputPublicUrl: string
30
29 fps: number 31 fps: number
30 toTranscode: { 32 toTranscode: {
31 resolution: number 33 resolution: number
@@ -50,7 +52,9 @@ abstract class AbstractTranscodingWrapper extends EventEmitter {
50 fps: number 52 fps: number
51 }[] 53 }[]
52 54
53 protected readonly inputUrl: string 55 protected readonly inputLocalUrl: string
56 protected readonly inputPublicUrl: string
57
54 protected readonly fps: number 58 protected readonly fps: number
55 protected readonly bitrate: number 59 protected readonly bitrate: number
56 protected readonly ratio: number 60 protected readonly ratio: number
@@ -76,7 +80,9 @@ abstract class AbstractTranscodingWrapper extends EventEmitter {
76 this.videoUUID = options.videoLive.Video.uuid 80 this.videoUUID = options.videoLive.Video.uuid
77 this.streamingPlaylist = options.streamingPlaylist 81 this.streamingPlaylist = options.streamingPlaylist
78 82
79 this.inputUrl = options.inputUrl 83 this.inputLocalUrl = options.inputLocalUrl
84 this.inputPublicUrl = options.inputPublicUrl
85
80 this.fps = options.fps 86 this.fps = options.fps
81 this.toTranscode = options.toTranscode 87 this.toTranscode = options.toTranscode
82 88
diff --git a/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts b/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts
index 1f4c12bd4..c82970b88 100644
--- a/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts
+++ b/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts
@@ -15,7 +15,7 @@ export class FFmpegTranscodingWrapper extends AbstractTranscodingWrapper {
15 async run () { 15 async run () {
16 this.ffmpegCommand = CONFIG.LIVE.TRANSCODING.ENABLED 16 this.ffmpegCommand = CONFIG.LIVE.TRANSCODING.ENABLED
17 ? await this.buildFFmpegLive().getLiveTranscodingCommand({ 17 ? await this.buildFFmpegLive().getLiveTranscodingCommand({
18 inputUrl: this.inputUrl, 18 inputUrl: this.inputLocalUrl,
19 19
20 outPath: this.outDirectory, 20 outPath: this.outDirectory,
21 masterPlaylistName: this.streamingPlaylist.playlistFilename, 21 masterPlaylistName: this.streamingPlaylist.playlistFilename,
@@ -31,7 +31,7 @@ export class FFmpegTranscodingWrapper extends AbstractTranscodingWrapper {
31 hasAudio: this.hasAudio 31 hasAudio: this.hasAudio
32 }) 32 })
33 : this.buildFFmpegLive().getLiveMuxingCommand({ 33 : this.buildFFmpegLive().getLiveMuxingCommand({
34 inputUrl: this.inputUrl, 34 inputUrl: this.inputLocalUrl,
35 outPath: this.outDirectory, 35 outPath: this.outDirectory,
36 36
37 masterPlaylistName: this.streamingPlaylist.playlistFilename, 37 masterPlaylistName: this.streamingPlaylist.playlistFilename,
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 345eaf442..6770a5e6f 100644
--- a/server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.ts
+++ b/server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.ts
@@ -4,7 +4,7 @@ import { AbstractTranscodingWrapper } from './abstract-transcoding-wrapper'
4export class RemoteTranscodingWrapper extends AbstractTranscodingWrapper { 4export class RemoteTranscodingWrapper extends AbstractTranscodingWrapper {
5 async run () { 5 async run () {
6 await new LiveRTMPHLSTranscodingJobHandler().create({ 6 await new LiveRTMPHLSTranscodingJobHandler().create({
7 rtmpUrl: this.inputUrl, 7 rtmpUrl: this.inputPublicUrl,
8 toTranscode: this.toTranscode, 8 toTranscode: this.toTranscode,
9 video: this.videoLive.Video, 9 video: this.videoLive.Video,
10 outputDirectory: this.outDirectory, 10 outputDirectory: this.outDirectory,