From 5569c2c68dbbc3330e229e2d8cb9951b9da4d080 Mon Sep 17 00:00:00 2001 From: Herman Chen Date: Thu, 14 Jan 2021 15:21:36 +0800 Subject: [PATCH] [rc]: Set statistic time to minimum 2s NOTE: Gop is better to be integer multiples of output fps. Change-Id: Id42e2e0c076d6c0a3f67756dc73dca7451b95ff6 Signed-off-by: Herman Chen --- mpp/codec/mpp_enc_impl.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mpp/codec/mpp_enc_impl.cpp b/mpp/codec/mpp_enc_impl.cpp index 74dbfacf..717dc788 100644 --- a/mpp/codec/mpp_enc_impl.cpp +++ b/mpp/codec/mpp_enc_impl.cpp @@ -900,7 +900,10 @@ static void set_rc_cfg(RcCfg *cfg, MppEncCfgSet *cfg_set) cfg->bps_target = rc->bps_target; cfg->bps_max = rc->bps_max; cfg->bps_min = rc->bps_min; - cfg->stat_times = 3; + mpp_assert(rc->fps_out_num); + cfg->stat_times = rc->gop * rc->fps_out_denorm / rc->fps_out_num; + if (cfg->stat_times < 2) + cfg->stat_times = 2; /* quality configure */ switch (codec->coding) {