From 84cae54e7a2595bea0c3ea106a4d111fd11a4ec6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 5 Aug 2022 10:36:19 +0200 Subject: Add option to not transcode original resolution --- server/lib/live/live-manager.ts | 14 ++++++++++---- 1 file changed, 10 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 bd47b01f9..1d1ecd935 100644 --- a/server/lib/live/live-manager.ts +++ b/server/lib/live/live-manager.ts @@ -4,7 +4,7 @@ import { createServer, Server } from 'net' import { join } from 'path' import { createServer as createServerTLS, Server as ServerTLS } from 'tls' import { - computeLowerResolutionsToTranscode, + computeResolutionsToTranscode, ffprobePromise, getLiveSegmentTime, getVideoStreamBitrate, @@ -26,10 +26,10 @@ import { federateVideoIfNeeded } from '../activitypub/videos' import { JobQueue } from '../job-queue' import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename, getLiveReplayBaseDirectory } from '../paths' import { PeerTubeSocket } from '../peertube-socket' +import { Hooks } from '../plugins/hooks' import { LiveQuotaStore } from './live-quota-store' import { cleanupPermanentLive } from './live-utils' import { MuxingSession } from './shared' -import { Hooks } from '../plugins/hooks' const NodeRtmpSession = require('node-media-server/src/node_rtmp_session') const context = require('node-media-server/src/node_core_ctx') @@ -456,11 +456,17 @@ class LiveManager { } private buildAllResolutionsToTranscode (originResolution: number) { + const includeInputResolution = CONFIG.LIVE.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION + const resolutionsEnabled = CONFIG.LIVE.TRANSCODING.ENABLED - ? computeLowerResolutionsToTranscode(originResolution, 'live') + ? computeResolutionsToTranscode({ inputResolution: originResolution, type: 'live', includeInputResolution }) : [] - return resolutionsEnabled.concat([ originResolution ]) + if (resolutionsEnabled.length === 0) { + return [ originResolution ] + } + + return resolutionsEnabled } private async createLivePlaylist (video: MVideo, allResolutions: number[]): Promise { -- cgit v1.2.3