From f443a74649174b2f9347c158e30f8ac7aa3e958a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 4 Mar 2022 13:40:02 +0100 Subject: Add latency setting support --- server/lib/live/live-manager.ts | 7 ++++--- server/lib/live/shared/muxing-session.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'server/lib/live') 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' import { computeLowerResolutionsToTranscode, ffprobePromise, + getLiveSegmentTime, getVideoStreamBitrate, - getVideoStreamFPS, - getVideoStreamDimensionsInfo + getVideoStreamDimensionsInfo, + getVideoStreamFPS } from '@server/helpers/ffmpeg' import { logger, loggerTagsFactory } from '@server/helpers/logger' import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config' @@ -353,7 +354,7 @@ class LiveManager { .catch(err => logger.error('Cannot federate live video %s.', video.url, { err, ...localLTags })) PeerTubeSocket.Instance.sendVideoLiveNewState(video) - }, VIDEO_LIVE.SEGMENT_TIME_SECONDS * 1000 * VIDEO_LIVE.EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION) + }, getLiveSegmentTime(live.latencyMode) * 1000 * VIDEO_LIVE.EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION) } catch (err) { logger.error('Cannot save/federate live video %d.', videoId, { err, ...localLTags }) } 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 { outPath, masterPlaylistName: this.streamingPlaylist.playlistFilename, + latencyMode: this.videoLive.latencyMode, + resolutions: this.allResolutions, fps: this.fps, bitrate: this.bitrate, @@ -133,7 +135,12 @@ class MuxingSession extends EventEmitter { availableEncoders: VideoTranscodingProfilesManager.Instance.getAvailableEncoders(), profile: CONFIG.LIVE.TRANSCODING.PROFILE }) - : getLiveMuxingCommand(this.inputUrl, outPath, this.streamingPlaylist.playlistFilename) + : getLiveMuxingCommand({ + inputUrl: this.inputUrl, + outPath, + masterPlaylistName: this.streamingPlaylist.playlistFilename, + latencyMode: this.videoLive.latencyMode + }) logger.info('Running live muxing/transcoding for %s.', this.videoUUID, this.lTags()) -- cgit v1.2.3