obs-ffmpeg: Missing NVENC bounds check

This commit is contained in:
jpark37 2021-03-18 22:10:17 -07:00 committed by Jim
parent 4404422082
commit 10c43f19c0

View File

@ -491,13 +491,16 @@ static bool init_encoder(struct nvenc_data *enc, obs_data_t *settings)
enc->output_delay = output_delay;
if (lookahead) {
int lkd_bound = output_delay - config->frameIntervalP - 4;
config->rcParams.enableLookahead = 1;
config->rcParams.lookaheadDepth =
max(enc->rc_lookahead, lkd_bound);
config->rcParams.disableIadapt = 0;
config->rcParams.disableBadapt = 0;
const int lkd_bound = output_delay - config->frameIntervalP - 4;
if (lkd_bound >= 0) {
config->rcParams.enableLookahead = 1;
config->rcParams.lookaheadDepth =
max(enc->rc_lookahead, lkd_bound);
config->rcParams.disableIadapt = 0;
config->rcParams.disableBadapt = 0;
} else {
lookahead = false;
}
}
/* psycho aq */