From b24c0e4ef76a739b305d2f6e58751e9df2c0869f Mon Sep 17 00:00:00 2001 From: matty Date: Sat, 13 Apr 2024 18:55:32 -0400 Subject: [PATCH] restore target bitrate settings --- dist/main.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/main.js b/dist/main.js index 7a2cd4a..50e5096 100644 --- a/dist/main.js +++ b/dist/main.js @@ -146,12 +146,12 @@ function buildInitOptions() { async function vodBuilder(params) { const { resolution, fps, streamNum, inputBitrate } = params; const streamSuffix = streamNum == undefined ? '' : `:${streamNum}`; - // let targetBitrate = getTargetBitrate(resolution, fps); - let targetBitrate = inputBitrate; + let targetBitrate = getTargetBitrate(resolution, fps); + // let targetBitrate = inputBitrate; let shouldInitVaapi = (streamNum == undefined || streamNum <= latestStreamNum); - // if (targetBitrate > inputBitrate) { - // targetBitrate = inputBitrate; - // } + if (targetBitrate > inputBitrate) { + targetBitrate = inputBitrate; + } logger.info(`Building encoder options, received ${JSON.stringify(params)}`); if (shouldInitVaapi && streamNum != undefined) { latestStreamNum = streamNum; @@ -176,12 +176,12 @@ async function vodBuilder(params) { async function liveBuilder(params) { const { resolution, fps, streamNum, inputBitrate } = params; const streamSuffix = streamNum == undefined ? '' : `:${streamNum}`; - // let targetBitrate = getTargetBitrate(resolution, fps); - let targetBitrate = inputBitrate; + let targetBitrate = getTargetBitrate(resolution, fps); + // let targetBitrate = inputBitrate; let shouldInitVaapi = (streamNum == undefined || streamNum <= latestStreamNum); - // if (targetBitrate > inputBitrate) { - // targetBitrate = inputBitrate; - // } + if (targetBitrate > inputBitrate) { + targetBitrate = inputBitrate; + } logger.info(`Building encoder options, received ${JSON.stringify(params)}`); if (shouldInitVaapi && streamNum != undefined) { latestStreamNum = streamNum;