Commit d08a82575d for aom
commit d08a82575de50dc99f3b3d324e7b8304836fe0ef
Author: James Zern <jzern@google.com>
Date: Wed Jul 22 12:46:56 2026 -0700
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 82ab1b2010..1a5949f5f4 100644
--- a/av1/encoder/rc_utils.h
+++ b/av1/encoder/rc_utils.h
@@ -74,12 +74,14 @@ static inline void config_target_level(AV1_COMP *const cpi,
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;