aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-04 13:40:02 +0100
committerChocobozzz <chocobozzz@cpy.re>2022-03-09 09:23:10 +0100
commitf443a74649174b2f9347c158e30f8ac7aa3e958a (patch)
treee423bc4e2307477bda4341037b7fa04ad10adae6 /server/lib
parent01dd04cd5ab7b55d2a9af7d0ebf405bee9579b09 (diff)
downloadPeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.gz
PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.zst
PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.zip
Add latency setting support
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/videos/shared/object-to-model-attributes.ts1
-rw-r--r--server/lib/live/live-manager.ts7
-rw-r--r--server/lib/live/shared/muxing-session.ts9
-rw-r--r--server/lib/server-config-manager.ts4
4 files changed, 17 insertions, 4 deletions
diff --git a/server/lib/activitypub/videos/shared/object-to-model-attributes.ts b/server/lib/activitypub/videos/shared/object-to-model-attributes.ts
index 1e1479869..c97217669 100644
--- a/server/lib/activitypub/videos/shared/object-to-model-attributes.ts
+++ b/server/lib/activitypub/videos/shared/object-to-model-attributes.ts
@@ -151,6 +151,7 @@ function getLiveAttributesFromObject (video: MVideoId, videoObject: VideoObject)
151 return { 151 return {
152 saveReplay: videoObject.liveSaveReplay, 152 saveReplay: videoObject.liveSaveReplay,
153 permanentLive: videoObject.permanentLive, 153 permanentLive: videoObject.permanentLive,
154 latencyMode: videoObject.latencyMode,
154 videoId: video.id 155 videoId: video.id
155 } 156 }
156} 157}
diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts
index 21c34a9a4..920d3a5ec 100644
--- a/server/lib/live/live-manager.ts
+++ b/server/lib/live/live-manager.ts
@@ -5,9 +5,10 @@ import { createServer as createServerTLS, Server as ServerTLS } from 'tls'
5import { 5import {
6 computeLowerResolutionsToTranscode, 6 computeLowerResolutionsToTranscode,
7 ffprobePromise, 7 ffprobePromise,
8 getLiveSegmentTime,
8 getVideoStreamBitrate, 9 getVideoStreamBitrate,
9 getVideoStreamFPS, 10 getVideoStreamDimensionsInfo,
10 getVideoStreamDimensionsInfo 11 getVideoStreamFPS
11} from '@server/helpers/ffmpeg' 12} from '@server/helpers/ffmpeg'
12import { logger, loggerTagsFactory } from '@server/helpers/logger' 13import { logger, loggerTagsFactory } from '@server/helpers/logger'
13import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config' 14import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config'
@@ -353,7 +354,7 @@ class LiveManager {
353 .catch(err => logger.error('Cannot federate live video %s.', video.url, { err, ...localLTags })) 354 .catch(err => logger.error('Cannot federate live video %s.', video.url, { err, ...localLTags }))
354 355
355 PeerTubeSocket.Instance.sendVideoLiveNewState(video) 356 PeerTubeSocket.Instance.sendVideoLiveNewState(video)
356 }, VIDEO_LIVE.SEGMENT_TIME_SECONDS * 1000 * VIDEO_LIVE.EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION) 357 }, getLiveSegmentTime(live.latencyMode) * 1000 * VIDEO_LIVE.EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION)
357 } catch (err) { 358 } catch (err) {
358 logger.error('Cannot save/federate live video %d.', videoId, { err, ...localLTags }) 359 logger.error('Cannot save/federate live video %d.', videoId, { err, ...localLTags })
359 } 360 }
diff --git a/server/lib/live/shared/muxing-session.ts b/server/lib/live/shared/muxing-session.ts
index f5f473039..a703f5b5f 100644
--- a/server/lib/live/shared/muxing-session.ts
+++ b/server/lib/live/shared/muxing-session.ts
@@ -125,6 +125,8 @@ class MuxingSession extends EventEmitter {
125 outPath, 125 outPath,
126 masterPlaylistName: this.streamingPlaylist.playlistFilename, 126 masterPlaylistName: this.streamingPlaylist.playlistFilename,
127 127
128 latencyMode: this.videoLive.latencyMode,
129
128 resolutions: this.allResolutions, 130 resolutions: this.allResolutions,
129 fps: this.fps, 131 fps: this.fps,
130 bitrate: this.bitrate, 132 bitrate: this.bitrate,
@@ -133,7 +135,12 @@ class MuxingSession extends EventEmitter {
133 availableEncoders: VideoTranscodingProfilesManager.Instance.getAvailableEncoders(), 135 availableEncoders: VideoTranscodingProfilesManager.Instance.getAvailableEncoders(),
134 profile: CONFIG.LIVE.TRANSCODING.PROFILE 136 profile: CONFIG.LIVE.TRANSCODING.PROFILE
135 }) 137 })
136 : getLiveMuxingCommand(this.inputUrl, outPath, this.streamingPlaylist.playlistFilename) 138 : getLiveMuxingCommand({
139 inputUrl: this.inputUrl,
140 outPath,
141 masterPlaylistName: this.streamingPlaylist.playlistFilename,
142 latencyMode: this.videoLive.latencyMode
143 })
137 144
138 logger.info('Running live muxing/transcoding for %s.', this.videoUUID, this.lTags()) 145 logger.info('Running live muxing/transcoding for %s.', this.videoUUID, this.lTags())
139 146
diff --git a/server/lib/server-config-manager.ts b/server/lib/server-config-manager.ts
index 43ca2332b..744186cfc 100644
--- a/server/lib/server-config-manager.ts
+++ b/server/lib/server-config-manager.ts
@@ -137,6 +137,10 @@ class ServerConfigManager {
137 enabled: CONFIG.LIVE.ENABLED, 137 enabled: CONFIG.LIVE.ENABLED,
138 138
139 allowReplay: CONFIG.LIVE.ALLOW_REPLAY, 139 allowReplay: CONFIG.LIVE.ALLOW_REPLAY,
140 latencySetting: {
141 enabled: CONFIG.LIVE.LATENCY_SETTING.ENABLED
142 },
143
140 maxDuration: CONFIG.LIVE.MAX_DURATION, 144 maxDuration: CONFIG.LIVE.MAX_DURATION,
141 maxInstanceLives: CONFIG.LIVE.MAX_INSTANCE_LIVES, 145 maxInstanceLives: CONFIG.LIVE.MAX_INSTANCE_LIVES,
142 maxUserLives: CONFIG.LIVE.MAX_USER_LIVES, 146 maxUserLives: CONFIG.LIVE.MAX_USER_LIVES,