From 016b5600e4e5abb5ae20fb3d075edd2dfad96b13 Mon Sep 17 00:00:00 2001 From: matty Date: Mon, 8 Jul 2024 18:16:18 -0400 Subject: [PATCH] re-enable logic for target and input bitrates --- dist/main.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dist/main.js b/dist/main.js index af7ff1f..48d2de4 100644 --- a/dist/main.js +++ b/dist/main.js @@ -215,13 +215,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 = getTargetBitrate(resolution, fps); // let targetBitrate = inputBitrate; let shouldInitVaapi = (streamNum == undefined || streamNum <= latestStreamNum); - // if (targetBitrate > inputBitrate) { - // targetBitrate = inputBitrate; - // } - let targetBitrate = inputBitrate; + if (targetBitrate > inputBitrate) { + targetBitrate = inputBitrate; + } logger.info(`Building encoder options, received ${JSON.stringify(params)}`); if (shouldInitVaapi && streamNum != undefined) { latestStreamNum = streamNum; @@ -250,8 +249,7 @@ 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 shouldInitVaapi = (streamNum == undefined || streamNum <= latestStreamNum); if (targetBitrate > inputBitrate) { targetBitrate = inputBitrate;