config_target_level: fix crash w/CONFIG_REALTIME_ONLY=1 `twopass->stats_buf_ctx` is `NULL` when this configuration is set. The initialization is skipped in `encoder_init()`. Change-Id: Ic74388e721912766db598649e1739992e0373a58
diff --git a/av1/encoder/rc_utils.h b/av1/encoder/rc_utils.h index 82ab1b2..1a5949f 100644 --- a/av1/encoder/rc_utils.h +++ b/av1/encoder/rc_utils.h
@@ -74,12 +74,14 @@ av1_get_max_bitrate_for_level(target_level, tier, profile); const int64_t max_bitrate = (int64_t)(level_bitrate_limit * 0.70); rc_cfg->target_bandwidth = AOMMIN(rc_cfg->target_bandwidth, max_bitrate); +#if !CONFIG_REALTIME_ONLY // Also need to update cpi->ppi->twopass.bits_left. TWO_PASS *const twopass = &cpi->ppi->twopass; FIRSTPASS_STATS *stats = twopass->stats_buf_ctx->total_stats; if (stats != NULL) cpi->ppi->twopass.bits_left = (int64_t)(stats->duration * rc_cfg->target_bandwidth / 10000000.0); +#endif // Adjust max over-shoot percentage. rc_cfg->over_shoot_pct = 0;