From 1e39ac631daa02205c274d7570c13b84d6abf8dc Mon Sep 17 00:00:00 2001 From: matty Date: Sun, 14 Apr 2024 01:32:46 -0400 Subject: [PATCH] re-add target bitrate get, rather than input stream --- dist/main.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/main.js b/dist/main.js index eee9c1a..5d8b1ef 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; @@ -179,12 +179,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;